类上的NotSerializableException,但是我的项目中没有Item类吗?

问题描述 投票:0回答:1

我有一个名为Items with的类,是用Serializable实现的,但是,当要读取数据时,系统在Item(如下面的图片链接)]上提示我NotSerializableException错误在我的项目中而不是Items类中不存在。我已经尝试过重建和清理项目,但是还是一样。感谢我的帮助,因为我一无所知。

public class Items implements Serializable {
   private String item;
   private String date;

   public Items(String item, String date) {
      this.item = item;
      this.date = date;
   }

   public String getItem() {
      return item;
   }

   public void setItem(String item) {
      this.item = item;
   }

   public String getDate() {
      return date;
   }

   public void setDate(String date) {
      this.date = date;
   }
}

图像如下:

Error on NotSerializableException image

我有一个名为Items with的类,是使用Serializable实现的,但是,当它要读取数据时,系统提示我Item类的NotSerializableException错误(如下图所示……)>

serializable notserializableexception
1个回答
0
投票
我无权发表评论,因此以书面形式作为答复。

请尝试使用Items对象重新生成文件,然后尝试反序列化。可能是文件较旧,并且是使用Item类而不是Items创建的。

© www.soinside.com 2019 - 2024. All rights reserved.