Explore BrainMass

Explore BrainMass

    Question about Java - working with files

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Write a Java application that reads from a text file a set of lines containing the persons data in the format
    last_name first_name age

    (one person per line, the fields are separated by one or more spaces or tabs). The program should create for each name a serialized object with 3 instance members: first and last names (as Strings) and age (as int), and put those objects in an ArrayList. After this, the program should create on the hard disk a binary file containing the saved objects in the serialized form.

    Provide exception handling for opening and reading from the input file. Also, provide exception handling for checking the input file format. Your program must explain to the user the reason for each exception and terminate if one is thrown.

    © BrainMass Inc. brainmass.com October 9, 2019, 10:50 pm ad1c9bdddf

    Solution Summary

    The solution explores working with files in Java.