February 2017
Beginner
1056 pages
28h 57m
English
In this section, we cover I/O for binary files involving objects of a class and arrays, which, you’ll recall, are really objects. We will use the classes ObjectInputStream and ObjectOutputStream.
We have seen how to write primitive values and strings to a binary file, and how to read them again. How would we write and read objects other than strings? We could, of course, write an object’s instance variables to a file and invent some way to reconstruct the object when we read the file. Since an instance variable could be another object that itself could have an object as an instance variable, however, completing this task sounds formidable.
Fortunately, Java provides ...
Read now
Unlock full access