本帖最后由 bronica_chen 于 2009-08-04 11:00:45 编辑

解决方案 »

  1.   

    访问nested class需要这样:OuterClass.InnerClass。
    你的例子需要这样:People.Student stu = new People.Student();
      

  2.   

    public static class Student{
      public Student(){}}加static描述
      

  3.   

    People.Student stu = new People.Student();
      

  4.   


    public class Course{
      People p = new People();
      People.Student stu = new Student();
      p.addNo(stu);//这个算什么,既不是field,也不是method
    }public class Course{
        {
        People p = new People();
        People.Student stu = p.new Student();
        
        p.addNo(stu);
        }
      }
      

  5.   

    public class People { public People() {
    } public void addNo(Student student) {
    } public static class Student {
    public Student() {
    } } public class Teacher {
    public Teacher() {
    } }
    }public class Course{
      public static void main(String []argv){

    People p= new People();
      People.Student stu = new People.Student();
       p.addNo(stu);
      }
    }
    这样才能编译通过