THIS IS MY JAVA HW: Object files: Instead of displaying the student data on the
ID: 3854099 • Letter: T
Question
THIS IS MY JAVA HW:
Object files: Instead of displaying the student data on the screen, change the program such that data in the array can be saved into an object file. Hint: Make the Student class serializable.
1. Add your own name as a new student into the array before having it saved into the object file.
OC:Windowslsystem32 cmd.exe DNJavajavac StudentData DNJava>java StudentData -Java First Name Last Name John Crack Jack Jack Mary Jane Java> studentsData.txt N. File Edit Format View Help 111 John Crack 333 Mary Jane 222 Jack JackExplanation / Answer
import java.io.Serialazable;
import java.io.*;
class serialDemo implements Serializable{
public static void main(String args[]) throws IOException
{
FileOutputStream fos=new FileOutputStream("obbject.ser");
ObjectOutputStream oos=new ObjectOutputStream(fos);
SerialDemo sd=new SerialDemo();
oos.flush();
oos.close();
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.