How to serialize ArrayList of objects?
问题 I want to serialize an arraylist of Item but it doesn't work.... my Item class extends Stuff class and has some subclasses . all of my classes implement Serilalizable. i have this part : try{ // Serialize data object to a file ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("MyData.ser")); out.writeObject(myData); out.close(); // Serialize data object to a byte array ByteArrayOutputStream bos = new ByteArrayOutputStream() ; out = new ObjectOutputStream(bos) ; out