Question
You are given the class Person.java. Using DataOutputStream and following the example given in Chapter 17 Example TestDataStream.java , write a Java program that creates
You are given the class Person.java. Using DataOutputStream and following the example given in Chapter 17 Example TestDataStream.java , write a Java program that creates three instances of the class Person and writes their attributes to a file named people.dat. This means you must create three objects of type Person with different attribute information. Write a second program (or continue on with the first after closing the written file) that reads from people.data using DataInputStream, recreates the Person Objects and prints them to the console using System.out.println and the Person.toString method Part II; Repeat the above using ObjectOutputStream and ObjectInputStream.
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