0

The netbeans show this eroor

Error with I/O processes java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: katanemimena1.Account at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369) at katanemimena1.ATM.actionPerformed(ATM.java:208)

and i dont understand why this is the code

ObjectInputStream in =null;
Account acc =null;
try{
in =new ObjectInputStream(new FileInputStream( "Accounts.txt"));
while
( (acc = (Account) in.readObject()) !=null){
System.out.println(acc);
}
}
catch(EOFException ex) {
System.out.println("End of file reached.");
}
catch(ClassNotFoundException ex) {
System.out.println("Error casting") ;
ex.printStackTrace();
}
catch(FileNotFoundException ex) {
System.out.println("Error specified file does not exist") ;
ex.printStackTrace();
}
catch(IOException ex) {
System.out.println("Error with I/O processes") ;
ex.printStackTrace();
}finally{
try{
in.close();
}
catch(IOException ex){
System.out.println("Another IOException during the closing");
ex.printStackTrace();
}

  }

1 Answers1

0

Implement your Account class from java.io.Serializable interface

Arsen Alexanyan
  • 3,061
  • 5
  • 25
  • 45