且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java“类中的构造函数不能应用于给定类型"“必需:找不到参数:字符串"

更新时间:2022-06-08 21:31:50

这个:

public void Node(String x) {
    data = x;
    next = null;
}

应该是:

   public Node(String x) {
        data = x;
        next = null;
    }

目前您有一个 default 构造函数(不带参数),它是在没有任何显式构造函数的情况下隐式定义的.

Currently you have a default constructor (taking no arguments), which is implicitly defined in the absence of any explicit constructors.