An ObjectOutputStream is inherited from the OutputStream class that is underlying in the java.io package. This class is used to write the primitive data types and also saves Java objects to an OutputStream that can be read by the ObjectInputStream. This stream performs "marshaling", i.e. it translates Java primitive and object types into a binary format, and vice versa. If you want persistent storage of objects then it can be accomplished by using a file I/O stream with the ObjectOutputStream through the Serialization.
Read more at
Recommend the tutorial