Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA-How to write data to a binary file? Here is my code. I want to write to binary file! any ideas? public void saveData(File file)
JAVA-How to write data to a binary file?
Here is my code. I want to write to binary file! any ideas?
public void saveData(File file) throws IOException{ FileOutputStream foss = new FileOutputStream("Database.txt"); ObjectOutputStream ooss= new ObjectOutputStream(foss); Student[] studentsarray = students.toArray(new Student[students.size()] ); ooss.writeObject(studentsarray); ooss.close();
}}
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