Advanced Java Tutorial

Total available pages count: 55
Subject - Java Technologies


The interface provides the facility to write the state of the object into a byte stream in compressed format. It isn’t a marker interface.


Externalizable has two methods:

public void writeExternal(ObjectOutput out) throws IOException
public void readExternal(ObjectInput in) throws IOException



At runtime, the serialization process associates an id with each serializable class which is called SerialVersionUID> . it is verifying the receiver & sender of a serialized object. Both the send & receiver should be the same with SerialVersionUID, or else InvalidClassException will be thrown while deserializing the object.

You can declare your SerialVersionUID in a serializable class. for that, we need to create the field SerialVersionUID & Assign a value to it.

private State final long serialVersionUID=1L;