The file I/O function is an extremely powerful tool that can make one of the most difficult and frustrating tasks of modern programming, namely transferring information between logically separate entities of code, much easier than it would otherwise be. Having said that, in this chapter, you will learn how to write and read data files using the FileWriter and BufferedWriter and FileReader and BufferedReader classes. We'll also look at the usage of the close () method and the Scanner class. Then you'll learn about exception handling. Finally, we will see one more aspect of I/O: the Serializable class.
Specifically, we'll cover the following topics in this chapter:
- Writing data to files
- Reading data from files
- The Serializable class