VS 代码上的 NoSuchMethodError 异常

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

截图1
enter image description here

截图2
enter image description here

截图3 enter image description here

在 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);
    }
}


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