Question: Piggyback off of the code StudentList class so that objects from that class can be written to a file. Provide an updated StudentList class heading
Piggyback off of the code StudentList class so that objects from that class can be written to a file. Provide an updated StudentList class heading so that the class supports serialization. Using this chapter’s WriteObject class as a guide, implement a StudentListFileWriter class with a main method that does the following.
• Instantiate an output file object where the filename comes from user input.
• Instantiate a StudentList object with student names Caiden, Jordan, Kelsey, Max, Jack, and Shelly.
• Write the StudentList object to the file.
• Call the remove method to remove Kelsey from the StudentList object.
• Call the file’s reset method.
• Append the updated StudentList object to the file.
If you want to test your solution to this exercise, do the next exercise.
Step by Step Solution
3.35 Rating (158 Votes )
There are 3 Steps involved in it
To accomplish the task you should first make sure your StudentList class implements the Serializable interface This will permit us to write objects of ... View full answer
Get step-by-step solutions from verified subject matter experts
