Question: Java question - I am totally out of my element. I need to deserialize an external file - if the file doesnt exist i need

Java question - I am totally out of my element.

I need to deserialize an external file - if the file doesnt exist i need to create it and prompt the user to populate their user name in an arraylist. Can i have an example please?

private void loadData() {

// check if the PATH + FILE_NAME file exists. If not, return.

// otherwise, use the example from the slides to deserialize the

// list of users serialized when the application exited last.

}

the file should serialize to a.dat file and when it deserializes it should populate the arraylist below.

private static final String PATH = System.getProperty("user.home") + File.separator + "sinclair" + File.separator;

private static final String FILE_NAME = "LinkedInUsers.dat";

private List users;

public LinkedInCLI() {

users = new ArrayList<>();

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!