| |
GeekInterview.com > Interview Questions > General > Interests
| Print | |
Question: What is the difference between Serializalble and Externalizable interface?
Answer: When you use Serializable interface, your class is serialized automatically by default. But you can override writeObject() and readObject()two methods to control more complex object serailization process. When you use Externalizable interface, you have a complete control over your class's serialization process. |
| December 12, 2005 02:16:33 |
#1 |
| Srinivasa Rao Yenti |
Member Since: Visitor Total Comments: N/A |
RE: What is the difference between Serializalble and E... |
Java gives you control over the serialization process through the java.io.Externalizable interface. The java.io.Externalizable interface extends the java.io.SerialiJava gives you control over the serialization process through the java.io.Externalizable interface. The java.io.Externalizable interface extends the java.io.Serializable interface by adding two methods: public void writeExternal(ObjectOutput out) public void readExternal(ObjectInput in) These methods are automatically called during serialization and de-serialization. Therefore, by providing code for these methods, you can implement your own serialization-specific operations, and, thus, have control over what data to, or not to serialize out. |
| |
Back To Question | |