bp4312
七步天下
2017-09-11 00:40

JAVA 子类无法在主函数new

  • java
  • 继承

各位大虾 代码如下
package example1;
class Person
{
private String name;
private int age;
public void setName(String name)
{
this.name=name;
}
public void setAge(int age)
{
this.age=age;
}
public String getName()
{
return name;
}
public int getAge()
{
return age;

}

class Student extends Person
{
private String school;
public String getSchool()
{
return school;
}
public void setSchool(String school)
{
this.school=school;
}

}

}
public class Test {

public static void main(String[] args) {


    // TODO Auto-generated method stub

}

}
为什么我在主函数中new student 会报错,说找不到student这个类呢

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

16条回答