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
How define set in java?
How does linkedhashmap work in java?
What does the append?
Explain method local inner classes ?
What are mutable classes?
What is polymorphism java example?
What is application system?
How to compare two strings in java program?
If an object reference is set to null, will the garbage collector immediately free the memory held by that object?
Differentiate between static and non-static methods in java.
What is a singleton class? Give a practical example of its usage.
What is the difference between a switch statement and an if statement?
What is incompatible types in java?
Explain polymorphism citing an example.
What is the difference between replace and replace all?