CS118: Programming for Computer Scientists

IO matters

Although Java is easier to use than many other languages for producing graphics, it is not as straightforward as it could be for data input.

For data output things are simple, you just use System.out.print and System.out.println. This accesses the Java System `default', as the name suggests.

For data input things are different. Unfortuanately Java has not made such a good job of this. To make your life a little easier the Department has created a nice slick means of inputting data. To use this you need to include uk.ac.warwick.dcs.util.io.IO at the top of your program. Once you have done this you can read an integer into your program, for example, using IO.readint.

How to use uk.ac.warwick.dcs.util.io.IO on a PC

To download the IO-package click on the following link with your right mouse button and save the file to your home directory Warwick IO library