Week13: File IO


Today we discussed the mechanics of try-catch blocks and the exception hierarchy in Java.  Here’s the example code that we discussed and traced several variations of in class, and here is a link to several visualizations of this hierarchy:


Today we worked through some more exception traces, and introduced the File class.  In addition to spending some time with the throw and throws keywords in Java, we also spent some time discussing the difference between relative and absolute paths.  Use the createNewFile() method of the File class also gave us some exposure to and practice with checked exceptions, specifically an IOException.


Today we discussed the useful of abstraction of generic input sources and output destinations: both how operating systems facilitate this and how this common functionality is shared between classes in the Java API using inheritance.  Here are some slides that we worked our way through before writing and discussing the following code: