- Exception Handling and Files

Lubomir Stanchev · 2013

This chapter covers two important topics: files and exception handling. The topics are covered together because every time we are working with a file, an exception can occur. This exception can be that the file does not exist, we do not have permission to open it, the hard disk is full and we are trying to save the file, and so on. We will cover two types of files: text and data. For text files, we will read and write regular text to a file. When it comes to data files, we will read and write objects to a file. We will cover checked and unchecked exceptions. While Java forces us to handle checked exceptions, such as opening a file, Java does not require that one handles unchecked exceptions, such as division by zero.

Read the paper · More papers on PaperTik