Using Object Streams
Java uses object streams to save data to persistent storage media and restore data back from the media. A stream is a path of communication between a data source and its destination. The object sending data through the stream is the producer and the item receiving data is the consumer. The Java Virtual Machine (JVM) requires that an object reads or writes its own state. A Java bean must implement the Serializable or Externalizable interface from Java's java.io package for it to be serialized properly.
Using Java's Serializable Interface
Java beans implementing the Serializable interface from Java's java.io package can save or retrieve their state. The Serialization interface does not define any methods or data fields, it ...