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
Tell us something about an iterator.
If a method is declared as protected, where may the method be accessed?
What is difference between static variable and global variable?
What does provide mean construction?
How do you replace all in word?
What is run time allocation?
How can we create an immutable class in java?
How do you start a new line in java?
What is meant by method overriding?
What does you mean in math?
If a variable is declared as private, where may the variable be accessed?
What is java full form?
What is the difference between instanceof and isinstance?
Is java programming easy?
What is 32 bit float?