Coin c = ...; ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("coins.dat")); out.writeObject(c);