Someone
public java v1 · immutable public void saveToFile() { try { fos= new FileOutputStream("database.txt"); //create output stream oos = new ObjectOutputStream(fos); //create object writing to stream oos.writeObject(people); //serialie object } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { try { if (oos != null) oos.close(); } catch (IOException e) {} try { if (fos != null) fos.close(); } catch (IOException e) {} } }