What is deserialization and how do we do deserialization?

Answer Posted / javamasque

Deserialization is a process of retrieving object from byte stream. We have to fallow below steps for de-serialization
1. The object to be serialized need to implement java.io.Serializable interface.
2. It will use Java’s default serialization mechanism.
3. Generate serial version id for that serializable object.
4. Only default constructor is applicable to all class hierarchy (from child to all super classes if any). It is necessary at deserialization otherwise throw InvalidClassException.
5. Generate serial version UID for all super classes in hierarchy (all super classes if any) otherwise the properties of all its super classes will be assigned to its default value during deserializtion.
6. ObjectInputStream is used to read [readObject()] object.
7. FileInputStream is used to read from flat file.
8. The flat file extension should be (<file-name>.ser)

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does chrome use java?

521


Can a constructor be protected?

534


What two classes are used to read data only?

640


What is communist flag?

572


What does it mean that a class or member is final?

559






placement papaers of spring computing technology

1026


What is function declaration?

532


What is singleton class in ruby?

564


What are the differences between processes and threads?

520


What do you mean by static variable?

578


Explain the importance of finally block in java?

568


What is stringbuffer in java?

543


What are internal variables?

559


Explain the concept of proper inheritance?

621


What is return used for in java?

522