Serializable
interface.
FileOutputStream output stream = new FileOutputStream("file name"); ObjectOutputStream object stream = new ObjectOutputStream(output stream); ... object stream.writeObject(instance); ... output stream.close();
FileInputStream input stream = new FileInputStream("file name"); ObjectInputStream object stream = new ObjectInputStream(input stream); ... object stream.readObject(); ... input stream.close();