I keep on getting syntax errors can someone fix it and also put into JOptionpane for me. And attach the required screenshots. import java.io.FileInputStream; import java.io.ObjectInputStream; public class Deserialization { public static void main(String[] args) throws Exception { FileInputStream file = new FilelnputStream("\"C:\\Users\\Guest\\Documents\|writeTestScores.txt\""); ObjectInputStream in = new ObjectInputStream(file); TestScores t = null; try{ while (true) { t= (TestScores) in.readObject(); System.out.println(t.averageTestScore()); } } catch (Exception e) { } in.close(); file.close(); System.out.println("Object has been deserialized "); } }
Ikeep on getting syntax errors can someone fix it and also put into JOptionpane for me. And attach the required screenshots.
public class Deserialization {
public static void main(String[] args) throws Exception {
FileInputStream file = new FileInputStream("\"C:\\Users\\Guest\\Documents\\writeTestScores.txt\"");
ObjectInputStream in = new ObjectInputStream(file);
TestScores t = null;
try {
while (true) {
t = (TestScores) in.readObject();
System.out.println(t.averageTestScore());
}
} catch (Exception e) {
}
in.close();
file.close();
System.out.println("Object has been deserialized ");
}
}
Step by step
Solved in 3 steps with 2 images