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

Discuss about garbage collector in Java.

753


What are different types of classloaders?

675


Define a package.

652


What is time complexity algorithm?

646


What is java in detail?

687






What is the difference between public, private, protected, and friend access?

665


What is meant by main method?

676


What are the three types of design patterns?

604


What are the steps involved to create a bean?

761


How do you convert int to char in java?

674


Write a program to print fibonacci series up to count 10.

590


Are primitives objects?

653


Can we override a variable in java?

649


Explain the importance of throwable class and its methods?

657


What is hashmap and map?

628