Java in a Nutshell

Previous Chapter 24
The java.io Package
Next
 

24.37 java.io.NotSerializableException (JDK 1.1)

This exception signals that an object could not be serialized. It is thrown when serialization is attempted on an instance of a class that does not implement the Serializable interface. Note that it is also thrown when an attempt is made to serialize a Serializable object that refers to (or "contains") an object that is not Serializable.

A subclass of a class that is Serializable can prevent itself from being serialized by throwing this exception from its writeObject() and/or readObject() methods.

public class NotSerializableException extends ObjectStreamException {
    // Public Constructors
            public NotSerializableException(String classname);
            public NotSerializableException();
}

Hierarchy:

Object->Throwable(Serializable)->Exception->IOException->ObjectStreamException->NotSerializableException


Previous Home Next
java.io.NotActiveException (JDK 1.1) Book Index java.io.ObjectInput (JDK 1.1)

Java in a Nutshell Java Language Reference Java AWT Java Fundamental Classes Exploring Java