by skoiloth on Wed May 09, 2007 12:16 pm
the Serializable and Cloneable are marker interfaces. All of these marker interfaces do not define methods; instead, they identify a class as having a particular capability.
In the case of Serializable, the interface specifies that if the class is serialized using the serialization I/O classes, then a NotSerializableException will not be thrown (unless the object contains some other class that cannot be serialized). Cloneable similarly indicates that the use of the Object.clone() method for a Cloneable class will not throw a CloneNotSupportedException.
Serializable is just a "marker interface." It doesn't declare any methods. It's just a flag that other methods can check. DataOutputStream.writeObject checks whether the class implements Serializable, and throws and excpetion if it doesn't.