Recently from any source, I came to know that custom serialisation is a process where we can define writeObject(ObjectOutputStream os) and readObject(ObjectInputStream is) in our Serializable class, and these methods will be executed at the time of serialisation and de-serialisation respectively to perform our functionality.
Later on, I came to know that Externalisation is an interface which defines 2 methods: 1- writeExternal() 2- readExternal()
Our class can implement Externalizable and override these methods when we don't want to serialise whole object. These methods will be executed at the time of serialisation and de-serialisation.
I have a doubt that why can't we use custom serialisation by implementing Serializable and defining writeObject(ObjectOutputStream os) and readObject(ObjectInputStream is) methods even to serialise some attributes of an object. Why this externalisation came into the picture.
Thanks,