Example & Tutorial understanding programming in easy ways.

how to serialization in java?

Serializable Interface
 Java provides two different ways to allow a class to be serialized. The first is to implement the Serializable interface. This is just a marker interface, meaning it contains no methods. Java will also implement a serialVersionUID variable, although it is advised manual assign the variable. It is the unique identifier Java uses to tell which class it is reconstructing from a byte stream (more on this later).
 This is the quickest and easiest way but gives you very little control over how the data is written. An implementation of Serializable with an example of a serialVersionUID variable.
 
 Externalizable Interface
 Externalizable is an interface that extends Serializable. Unlike Serializable, Externalizable is not a marker interface. It requires an implementation of the methods readExternal() and writeExternal(). In addition
 to these methods, the class must also have a default constructor. This is because when using readExternal() and writeExternal(), a constructor is actually called for the object and then its variables are updates. This allows for a faster execution time than Serializable. To implement readExternal() and writeExternal() manually write the variables of the class to the output stream given. 

Read More →