SUNY Geneseo Department of Computer Science
{Date}
CSci 141, Fall 2003
Prof. Doug Baldwin
Exam 1 is this Friday (Oct. 10)
Reading files for homework 1
Text differs from arbitrary data
Generic code to get text from a file
Step 1
FileReader r = new FileReader( "SimpleHunt.txt" );
BufferedReader in = new BufferedReader( r );
or
BufferedReader in = new BufferedReader( new FileReader( "SimpleHunt.txt" ) );
Step 2
String lineOfText = in.readLine();
RobotRoom room = new RobotRoom( lineOfText );
Directories and Path Names
Exceptions
try {
... code that might throw exception
}
catch ( Exception e ) {
... code to handle exceptions
}
Recurrence relations
Read Section 7.2.1