【发布时间】:2018-04-04 13:09:25
【问题描述】:
public class StudentApp {
public static void main(String[] args) {
Student student1 = new Student("test");
Student student2 = new Student("test","test");
System.out.println(student2.getId());
}
}
构造函数如下所示:
public Student(String firstName, String lastName){
this.id=nextId++;
this.name = firstName+" "+lastName;
}
student2 的第一个参数是“预期的‘类’或‘接口’”,但它编译并运行得很好。这里可能有什么错误?
【问题讨论】:
-
看起来像this
-
重启 IDE 有帮助吗?
-
没有,但我想通了,看看我的回答。谢谢
标签: java class intellij-idea interface