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
What is toarray method in java?
Why are getters and setters used?
Can you add null to a list java?
Which is better 64 bit or 32 bit?
I want my class to be developed in such a way that no other class (even derived class) can create its objects. How can I do so?
if u open login & logout ,how can udisplay the timelogin & logout members ?
What are different types of expressions?
How java enabled high performance?
How do you convert int to char in java?
What is the exact difference in between Unicast and Multicast object? Where will it be used?
What is a treeset class?
Is null or empty java?
What do you know about java?
What is a parameter example?
What is the purpose of the system class in java programming?