is it necessary for validation?
java.io.Serializable is an interface that is entirely empty. A class can implement this interface simply by naming it in its implement clause without having to implement any methods. This technology is a useful way to provide additional imformation about an object, and it does not affect the normal operation on an object.
java.lang.Cloneable is another such interface. It defines no method, but identifies the class as one that allows its internal state to be cloned by the clone()method of the
Object class. For example:
Object o;
Object copy;
if(o instanceof Cloneable) copy = o.clone();
else copy = null;
Now, let's come back to java.io.Serializable interface. A class should implement this interface simply to indicate that it allows itself to be serialized and deserialized with
ObjectOutputStream.writeObject() and
ObjectInputStream.readObject(). In other words, the class should be converted into a stream of bytes that can later be deserialized back into a copy of the original object. When to use it? in the area of network programming and distributed programming, because they have issues such as delivery delay, difference of systems, and network failing.
Regards,
Weij