Java example of writing object to file

Thanks for the explanation, Everett. Merging.