当我添加toString方法时,我的代码向我显示以下消息:
错误消息:无法创建方法实现,原因 JavaVirtualMachien不在构建路径中
虽然我有JavaVirtualMachiens,并且在以前的项目中一直使用toString。我该怎么解决?
public class Student {
private int id;
private String name;
private Double Gpa;
public Student(int id, String name, double gpa) {
super();
this.id = id;
this.name = name;
Gpa = gpa;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Double getGpa() {
return Gpa;
}
public void setGpa(Double gpa) {
Gpa = gpa;
}
}