read and write arraylist to file java code example
Example: java write arraylist of objects to file
try {
FileOutputStream fos = new FileOutputStream("output");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(MenuArray); // write MenuArray to ObjectOutputStream
oos.close();
} catch(Exception ex) {
ex.printStackTrace();
}