What is difference between compatible and incompatible changes in serialization?

Answer Posted / javamasque

Compatible changes
Some modifications that happed in serializable class after serialization (written to flat file / DB) but there is no exception during de-serialization is called compatible change. These are as below
1. Addition of new field.
2. Static field became non-static.
3. Transient field became non-transient
4. New super class added in class hierarchy.

Incompatible changes
Some modifications that happed in serializable class after serialization (written to flat file / DB) and there is an exception during de-serialization due to the changes is called incompatible change. These are as below
1. Delete existing field.
2. Non-static field became static.
3. Non-transient field became transient
4. Any super class removed in class hierarchy.
5. Field data type changed.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is stack example?

537


how does multithreading take place on a computer with a single cpu? : Java thread

686


Is hashset ordered?

540


Can we override final method?

558


what is deadlock? : Java thread

519






What is the difference between form & report?

584


Explain the importance of finally block in java?

564


What is static class

610


Which is faster string or stringbuilder?

510


What do you understand by an io stream?

573


What is java reflection?

529


What is variable and its types?

535


How to compare two strings in java program?

667


What does singleton class mean?

529


What are the advantages of functions?

515