DEVFYI - Developer Resource - FYI

How do I serialize an object to a file?

Java Interview Questions and Answers (part 3)


(Continued from previous question...)

500. How do I serialize an object to a file?

The class whose instances are to be serialized should implement an interface Serializable. Then you pass the instance to the ObjectOutputStream which is connected to a fileoutputstream. This will save the object to a file.

(Continued on next question...)

Other Interview Questions