CS141: Topics for Oct 14 & 16, 2013
Homework and Reading
The reading and homework for this week can be found here: Lab 8
Begin working on the new programming assignment, TicTacToe. Instructions (pdf)
and TicTacToeStubs Netbeans Project (zip)
Finish Chapter 6:
Chp 6 - Arrays and ArrayLists: We still need to cover 2D Arrays and ArrayLists
Chp 7 Vocabulary
File
Ascii (text) file vs binary file
Opening a file
Closing a file
White space
|
Exception
Throwing an Exception
Catching an Exception
try-catch
Delimiter
|
Topics: Chp 7 - Input/Output and Exception Handling
Note, we will not cover everything in this chapter. Your main task is
to become familiar with the code in the Netbeans project: IOExampleProject (zip file)
- Reading ascii text files using the Scanner and File classes
- Writing to ascii text files using the PrintWriter class
- Opening and closing
- Binary data (anything other than ascii, e.g. images) - can't be represented on a console
- Checking for more data using in.hasNextInt(), in.hasNextDouble(). These return a boolean value.
- Reading words (tokens) vs lines using next()
- Converting Strings to numbers, e.g. using Double.parseDouble, Integer.parseInt()
- Exception Handling; Dealing with errors; How to gracefully survive a crash.
- Throwing an exception
- Catching an exception; Catching multiple exception types
- Types of Exceptions - see Javadoc for the Exception class
- The finally clause - cleaning up no matter what happens, e.g. closing a file
In Class Practice Activities