Home Segments Top Top Previous Next

Chapter 34:

How to Write and Read Values
Using the Serializable Interface

In Chapter 27 and Chapter 33, you learned how to read data from and write data to humanly readable text files. Storing data in text files has serious disadvantages, however. For example, to prepare programs that write values to text files, you must decide how to represent values as character strings, and you must write programs that translate values into such character strings. Then, you must write programs that translate character strings back into values.

Fortunately, Java offers methods that handle details of writing and reading for you. If you use these methods, instead of handling writing and reading details yourself, you simplify your programs, you store data more compactly, and you store and retrieve data faster.