Question: 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

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