What is deserialization and how do we do deserialization?

Answers were Sorted based on User's Feedback



What is deserialization and how do we do deserialization?..

Answer / 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

What is deserialization and how do we do deserialization?..

Answer / javamasque

Here is updated answer
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. 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.
5. ObjectInputStream is used to read [readObject()] object.
6. FileInputStream is used to read from flat file.
7. The flat file extension should be (<file-name>.ser)

Is This Answer Correct ?    1 Yes 0 No

What is deserialization and how do we do deserialization?..

Answer / 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 / java.io. Externalizable interface.
2. Generate serial version id for that serializable object.
3. ObjectInputStream is used to read [readObject() or readExternal()] object.
4. FileInputStream is used to read from flat file.
5. The flat file extension should be (<file-name>.ser)

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More Core Java Interview Questions

Why deletion in linkedlist is fast than arraylist?

0 Answers  


How does JAVA ClassLoader work?

1 Answers   IBM,


Why do we need hashset in java?

0 Answers  


What is the difference between instanceof and isinstance?

0 Answers  


Hai friends I am MCA 2006 passout. Spend time in 1 yr for teacing and 5 months in small s/w firm. worked in 4 or 5 months in few places. Presently I am writing bank exams. I want to get back to IT sector. Are there any possibilities. any growth prospects?. I am having some knowledge in core and advanced java. I am so desperate. Any suggestions thanks in advance. u can write to my mail mahidestiny@gmail.com

4 Answers  






Can we create object of inner class in java?

0 Answers  


In method overloading ,if i change the return type to Long instead of INT,is the program execute

6 Answers   HCL,


Does A Class Inherit The Constructors Of Its Superclass?

0 Answers   Wipro,


Explain when noclassdeffounderror will be raised ?

0 Answers  


What is flush buffer?

0 Answers  


Is it possible to cast an int value into a byte variable? What would happen if the value of int is larger than byte?

0 Answers  


What is Exception handling in Java How do you handle run time errors please explain with an example

2 Answers   Mastek, TCS,


Categories