Answer Posted / javamasque
Here is the updated answer
We have to fallow below steps to serialize an object
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. ObjectOutputStream is used to write [writeObject] object.
6. FileOutputStream is used to persist in flat file.
7. The flat file extension should be (<file-name>.ser)
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the difference between logical data independence and physical data independence?
how would you implement a thread pool? : Java thread
What is a java string?
Which data type is a class in java?
What is void class in java?
What is lazy initialization in java?
Can a class have more than one object?
Why set is used in java?
When does an object becomes eligible for garbage collection in java?
What is the main use of java?
What is a parameter example?
What does flagged out mean?
Why hashcode is used in java?
What is the purpose of extern variable?
What is the purpose of abstract class?