In Code Sample:How to create a class that creates a instance of the UserInfo class and writes the object to an output stream?

Create a class that creates a instance of
the UserInfo class and writes the object to an output
stream as shown in Code Sample. The output stream in this example is a
file called "name.out". The important thing to note from Code Sample
is that the writeObject method can be called any number
of times to write any number of objects to the output stream.