0

netbeans 显示这个 eroor

I/O 进程出错 java.io.WriteAbortedException:写入中止;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)

我不明白为什么这是代码

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();
}

  }
4

1 回答 1

0

从 java.io.Serializable 接口实现您的 Account 类

于 2013-02-21T17:35:38.353 回答