ClassCastException when Appending Object OutputStream

后端 未结 3 2032
伪装坚强ぢ
伪装坚强ぢ 2020-12-09 14:00

I have been trying to do a little project that needs an appendable ObjectOutputStream. I have gone through a couple of solutions and i found this It seemed to solve my probl

3条回答
  •  北海茫月
    2020-12-09 14:19

    Try it like this....

    readObject() returns the objects of type Object, so you need to explicitly cast them into its original types...

    Eg:

    PPAccount pa = (PPAccount) readObject();

提交回复
热议问题