Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This method is used to write and save data in Java. I am not quite sure what is going on here. Could someone please comment
This method is used to write and save data in Java. I am not quite sure what is going on here. Could someone please comment this code so I can get a better understanding? if(input == 'S') { try { FileOutputStream f0; file = new FileOutputStream("savedGame"); ObjectOutputStream oOStrm = new ObjectOutputStream(file); oOStrm.writeObject(this); oOStrm.close(); System.out.println("Game saved"); } catch (IOException e) { e.printStackTrace(); System.out.println("Save unsuccessful"); } } return; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started