Class 找不到错误
我有一个主要的错误谁能帮我找到错误在哪里?我试图创建一个类,并使用setter/getter设置每个字段,最终我将测试这个类,以确保这些字段正常工作Class 找不到错误,class,field,Class,Field,我有一个主要的错误谁能帮我找到错误在哪里?我试图创建一个类,并使用setter/getter设置每个字段,最终我将测试这个类,以确保这些字段正常工作 public class College{ public class person{ private String name; private int age; private double id; //constructor to set fields
public class College{
public class person{
private String name;
private int age;
private double id;
//constructor to set fields
public Schedule (String name, int age, double id){
this.name= name;
this.age= age;
this.id= id;
}
public String getName(){
return this.name;
}
public void setName(String Name) {
this.name= name;
}
public int getAge(){
return this.Age;
}
public void setAge(int age) {
this.age = age;
}
public double getId(){
return this.id;
}
public void setId(double id) {
this.id = id;
}
}
public static void main(String[] args) {
Schedule Per1= new College("John", 2,2.0);
}
}
我想您可能想了解如何正确创建类。 下面的链接将帮助您使用C:
您需要从main中显示代码,在这里您尝试实例化/操作该类。
public class person{
private String name;
private int age;
private double id;
//constructor to set fields
public person(String name, int age, double id){
this.name= name;
this.age= age;
this.id= id;
}
public String getName(){
return this.name;
}
public void setName(String Name) {
this.name= name;
}
public int getAge(){
return this.Age;
}
public void setAge(int age) {
this.age = age;
}
public double getId(){
return this.id;
}
public void setId(double id) {
this.id = id;
}
}
public static void main(String[] args) {
person Per1= new person("John", 2,2.0);
}