Below is an example detailing steps to take on serializing and de-serializing an object.
Why do you need to know about serialization? The process of serialization allows an object’s state to be converted to bytes and transferred over a network or saved to a hard disk. While deserialization reconstructs the object from its bytes.
1. Create the class to be serialized and implement the Serializable interface.
NOTE: The NotSerializableException will be thrown if the object to be serialized does not implement the java.io.Serializable interface.