Note that both PhoneEntry.java and PhoneBook.java are marked as Serializable; no other work was done to these two classes to make them work with serialization.
javac Phones.java
Run the solution by typing
java -ea Phones add zoe 555-9876
or the like. The -ea option enables assertion checking, which is
helpful during development.
For example (where % marks lines entered by the user):
ls phone-book.dat
/bin/ls: phone-book.dat: No such file or directory
% java -ea Phones add zoe 555-9876
% java -ea Phones get zoe
Phone # for zoe: 555-9876
% java -ea Phones get rich
No phone entry for rich
% java -ea Phones add zoe 555-6789
% java -ea Phones get zoe
Phone # for zoe: 555-6789