.
|
.
|
/**************************************************
|
The original email collection program saved the addresses in an
array. When the program ended, all the addresses
disappeared, because the array is stored in RAM and that is erased
whenever a program ends or the computer shuts down.
This program is much better. Each time an address is added, the
program copies the entire array into a text-file
stored on the disk drive. When the program starts the next time,
it automatically loads the contents of the text-file
into the array.
This persistent storage is achieved by object
serialization. The relevant Java commands are contained
in the
methods loadArray( ) and
storeArray( ) . An explanation
of these commands is beyond the scope of this course.
But they do work correctly.
There are other ways to store data and retrieve it from a data file -
these will be explored in later examples.