HOW DO I SERIALIZE AN OBJECT TO A FILE?

Sumit Kesarwani

Total Post:782

Points:3910
Posted by  Sumit Kesarwani
Java 
 894  View(s)
Ratings:
Rate this:
  1. Sumit Kesarwani

    Post:782

    Points:3910
    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.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!