Java 反序列化ArrayList。没有有效的构造函数

Java 反序列化ArrayList。没有有效的构造函数,java,serialization,io,persistence,deserialization,Java,Serialization,Io,Persistence,Deserialization,这就是我如何反序列化包含标识对象的arrayList public void deserializeArrayList(){ String path = "./qbank/IdentificationHARD.quiz"; try{ FileInputStream fileIn = new FileInputStream(path); ObjectInputStream in = new ObjectInputStream(fileIn

这就是我如何反序列化包含标识对象的arrayList

public void deserializeArrayList(){
    String path = "./qbank/IdentificationHARD.quiz";
    try{
          FileInputStream fileIn = new FileInputStream(path);
            ObjectInputStream in = new ObjectInputStream(fileIn);
            ArrayList<Identification> list = (ArrayList<Identification>) in.readObject();
            System.out.println(list);
    }catch(Exception e){
        e.printStackTrace();
    }
}
这是92号线

ArrayList<Identification> list = (ArrayList<Identification>) in.readObject();
问题是java中的-->

Java serialization process  only continues in object hierarchy till the class
is Serializable i.e. implements Serializable interface in Java.
在您的类中,您正在调用不可序列化的
super
类构造函数

这就是问题所在:)

关于第二个问题,请看一看


你的
标识
对象呢?你能把你的标识代码放进去吗class@SumitSingh我更新了它,请选中为
标识创建默认构造函数。为什么要添加默认构造函数?我还需要空构造函数吗?连载?你在哪里找到的?“Java序列化过程仅在对象层次结构中继续,直到类可序列化,即在Java中实现可序列化接口。”?
ArrayList<Identification> list = (ArrayList<Identification>) in.readObject();
 package quizmaker.management; 
 import java.io.Serializable;
 import quizmaker.Accounts.Rights.IAnswerable;

public class Identification extends Question implements Serializable{

    private static final long serialVersionUID = 2L;
    private String question;
    private String answer;

    public Identification(String q , String a){
        super(q,a);
    }

    public String toString(){
        return String.format("Question: %s\n Answer %s", getQuestion(),getAnswer());
    }
}
Java serialization process  only continues in object hierarchy till the class
is Serializable i.e. implements Serializable interface in Java.
During deserialization, the fields of non-serializable classes will be 
initialized using the public or protected no-arg constructor of the class.
A no-arg constructor must be accessible to the subclass that is serializable.
The fields of serializable subclasses will be restored from the stream.