How will you override default serialization mechanism in java

Answer Posted / sharmila

Serializable is a marker interface. But you may wish to
control on how an object is serialized instead of using the
default mechanism. In such case add implementations of the
readObject() and/or writeObject() methods to the class being
serialized and override default serialization mechanism.

Also, instead of using Serializable interface,
Externalizable interface can be used

Is This Answer Correct ?    4 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of strings?

772


Can we use switch statement with strings?

798


How do you override a private method in java?

683


What classes of exceptions may be caught by a catch clause in java programming?

917


What are the skills required for core java?

755


What are the two environment variables that must be set in order to run any java programs?

714


What is the destroy method?

804


What causes memory leak in java?

687


What is the length of a string?

728


When does an object becomes eligible for garbage collection in java?

806


What is an immutable class? How to create an immutable class?

774


Can I learn java in 3 months?

754


Name the components that are termed to be Heavy-weight component but available in Light-weight components?

2185


In which language java is written?

734


Can we have multiple classes in single file ?

809