所以我有一个在构造函数中有两个参数的超类。超类构造函数使用单个变量定义一个成员,但第二个变量用于检查它们是否为空。因此,在子类构造函数中,我调用super,然后定义另一个变量的成员。调试时,它将在调用super之后使用第二个变量跳过声明。我将提供一些非特定代码。
public abstract class Foo{
private enum type; #the enum is defined its not just enum written
public Foo(enum type, String str){
Objects.requireNonNull(type, "Given type must not be null.");
Objects.requireNonNull(str, "Given string input must not be null.");
this.type = type;
}
...
methods
...
}
现在是子类
public class Bar extends Foo{
private String str;
...members...
public Bar(enum type, String str){
super(type, str);
this.str = str;
}
}
因此在调试中,此行this.str = str;被跳过完成。为什么会这样?