How do we make a class serialize?

Answer Posted / javamasque

We have to fallow below steps to serialize an object
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. ObjectOutputStream is used to write [writeObject(..) or wirteExternal()] object.
4. FileOutputStream is used to persist in flat file.
5. The flat file extension should be (<file-name>.ser)

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is google full form?

537


Can a class have a static inner class?

607


What is a void in java?

584


What is operator overloading. Is it is supported in java?

524


What is a subsequence of a string?

549






What is starvation?

684


What do you mean by exception handling in Java?

662


Name few "optional" classes introduced with java 8 ?

651


How many days will it take to learn java?

519


How does arrays sort work in java?

604


Which container method is used to cause a container to be laid out and redisplayed in java programming?

604


What is java and why do we need it? Explain

585


What does percent mean in java?

591


Explain the key functions of data binding?

584


What is the use of static class?

548