| 本帖最后由 薛鹏鹏 于 2013-7-21 12:11 编辑 
 在外部类中访问内部类中的静态和非静态成员,编译不通过。。。
 Outer.Inner.function();这个是照老师的格式打的
 复制代码class Outer
{
        private static int x = 3;
        static class Inner  //静态内部类
        {
                
                void function()
                {
                System.out.println("inner:"+x);
                }
        }
}
class InnerDemo 
{
        public static void main(String[] args) 
        {
                new Outer.Inner().function();//直接访问内部类中的成员
                System.out.println("Hello World!");
                Outer.Inner.function();// 这里这里
        }
}
 |