Question: Help code program in Java 1. Write the following programs that read from and write to a binary file using the DataOutputStream and the DatainputStream
1. Write the following programs that read from and write to a binary file using the DataOutputStream and the DatainputStream of the java.io class: a. WriteBinaryInfo.java that writes info from parallel arrays. Create 3 parallel arrays that hold firstInitial (char), lastName (String) and age (int). Hardcode some sample data and write the data to a file named Lab8.ser b. ReadBinaryinfo.java that reads from this file and displays its contents on the terminal window. (note: don't use arrays in this program, you only have to print the data to the terminal window, you don't have to assign the values to variables or to arrays) Sample formatted output: W. Yeats, 74 J. Joyce, 59 B. Behan, 41 D. Bruadair, 25 Note: The method available() of DatainputStream returns an integer greater than of there are bytes to read
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
