Posts

Showing posts with the label NotSerializableException

Serialization in Java

Serialization is the process of converting an object's state into byte sequence ( to persist it on to a file ), and to rebuild ( deserialize ) those bytes into an object. To make an object serializable, the object should implement java.io.Serializable interface. Lets take an example to understand Serialization in Java. Firstly lets define a serializable object ############################################################### package learn.java.serialization; import java.io.Serializable; public class SerializableObject implements Serializable { private String message; public SerializableObject(){ } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } } ############################################################### As you must have noticed the only special thing that we have done  to the class is implement Serializable. The java.io.Serializable ...