public Life(List<class> classes, int schoolwork) {
        super(classes, schoolwork);
    }


我试图用这段代码制作一个Life对象,但是我做的不正确

Life life = new Life();


但我不知道如何正确设置参数以包括班级和功课。

最佳答案

我试图解释您的问题,并编写了一段代码,向您展示如何通过传递正确的参数来创建Life对象。

也许您的问题是创建List对象(?)



public class Main {

    public static void main(String[] args) throws IOException {
        List<CustomClass> customClass = new ArrayList<>();
        int schoolwork = 1;

        Life life = new Life(customClass, schoolwork);
    }

}

class CustomClass {
}

class Life {

    /**
     * Constructor
     *
     * @param customClass
     * @param schoolwork
     */
    public Life(List<CustomClass> customClass, int schoolwork) {
        // super(strings, schoolwork);
    }

}

10-07 22:37