How to read and write an object to a text file in java?
问题 I have an array of objects and I want to write them in a text file. So that I can later read the objects back in an array. How should I do it? Using Serialization. Deserialization is not working: public static void readdata(){ ObjectInputStream input = null; try { input = new ObjectInputStream(new FileInputStream("myfile.txt")); // getting end of file exception here } catch (FileNotFoundException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } try { array =