Title: Checked Exceptions
Course: CPS 261: Advanced Java Concepts ~ DL & MM MASTER > Section: Learning Units - Bb

Presentations and Videos

- Checked Exceptions lecture video (Time: 37:00)
- Checked Exceptions document

- Using the Scanner class to read a file using FileInputStream ( it's similar to reading from the keyboard).
- Using the PrintStream class to produce output using FileOutputStream( it's similar to writing to System.out).
- Checked exceptions occur with most file input/output. Checked exceptions need to be caught or else a compiler occurs.
- Instead of catching an exception, you can "pass the buck" and pass the exception back to the caller with a statement like: throws FileNotFoundException
- The "finally" clause can be used to make sure that something happens before exitting a "try" block.
- Writing code that throws an Exception to prevent user's from improperly using your program. This is demonstrated in the Game-of-Life program. Note that the type of exception you choose can be checked or not-checked. You can even create and throw your own unique Exception class in order to store extra information.