Question: ASAP PLEASE!! With Explanataion please. Running through exam. Plagiarism-Less. Write the code that use ObjectOutputStream to write the data fields from below StudentInfo class to

ASAP PLEASE!! With Explanataion please. Running through exam. Plagiarism-Less.

Write the code that use ObjectOutputStream to write the data fields from below StudentInfo class to an output file output.dat.

import java.util.Date;

public class StudentInfo {

String name;

String ID;

String major;

java.util.Date date;

public String

getName()

{

return name;

}

public void setName(String name) {

this.name = name;

}

public String getID() {

return ID;

}

public void setID(String ID) {

this.ID = ID;

}

public String getMajor() {

return major;

}

public void setMajor(String major) {

this.major = major;

}

public Date getDate() {

return date;

}

public void setDate(Date date) {

this.date = date;

} }

1. create the test class.

2. create the StudentInfo object and set all the fields with the correct values in the test class main function

3. create ObjectOutputStream and use the correct methods for each data field of StudentInfo (such as the writeUTF) to write the content to the output file.

Hint: you can refer to the TestObjectOutputStream example code in example codes of chapter 17.

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 Programming Questions!