Yes, the serialization process can be customized. When an object is serialized,
objectOutputStream.writeObject (to save this object) is invoked and when an
object is read, ObjectInputStream.readObject () is invoked. What most people do
not know is that Java Virtual Machine provides you with an option to define
these methods as per your needs. Once this is done, these two methods will be
invoked by the JVM instead of the application of the default serialization
process. Classes that require special handling during the serialization and
deserialization process must implement special methods with these exact
signatures:
private
void
writeObject(java.io.ObjectOutputStream out)
throws IOException
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException;
private void readObjectNoData()
throws ObjectStreamException;
Read More →Core Java Interview Questions
Object Oriented Programming(OOP) Questions and Answers
Collections Interview Questions
Java Exceptions Interview Questions
Java Threads Interview Questions
Collection framework in java interview questions
oops concepts with example in java
Java Serialization Interview Questions
Top 20 Core Java Interview Questions with Answers
String Interview Question in java With Example
synchronization interview questions
Java Reflection Interview question
Java Executor Framework (JDK 1.5) Interview Questions
JDK 1.7 interview Questations and Answers
Java I/O interview question with example