~/ learn/ comp-308/ cards/ Serialization & deserialization
1 of 7

Serialize an object to a file

Serialize an object to a file

Answer

ObjectOutputStream out = new ObjectOutputStream( new FileOutputStream("dump.out")); out.writeObject(gc);

ObjectOutputStream wraps a byte sink (FileOutputStream); writeObject(gc) serializes gc and its whole object graph to dump.out.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/61155635-6595-4905-a14e-b83eff83d95a/flashcard utf-8 LF