截图1
截图2
截图3
在 vs 代码中得到 NoSuchMethodError 但在 Notepad++ 上工作我的 vs 代码配置有什么问题
请给出一些想法,这个问题的错误是什么 java版本:jdk 17
class Base {
protected int x = 10;
public static int y = 20;
public Base() {
x = ++y;
}
public Base(int x) {
this.x = x + ++y;
}
public int foo() { return x; }
public static int goo() { return y; } }
class Derived extends Base {
protected int x = 300;
public static int y = 400;
public Derived() {
x = ++y;
}
public Derived(int x1, int x2) {
super(x1);
this.x = x2 +++y;
}
public int foo() { return x; }
public String toString() { return String.format("super.x=%d, x=%d", super.x, x);
}
}
public class TestMCQ {
public static void main(String[] args) {
Base b1 = new Derived();
Base b2 = new Derived(2, 3);
System.out.println(b1);
System.out.println(b2);
}
}