标题:这里使用static为什么出错了呢?
取消只看楼主
msl12
Rank: 1
等 级:新手上路
帖 子:152
专家分:0
注 册:2015-2-6
结帖率:25%
 问题点数:0 回复次数:1 
这里使用static为什么出错了呢?
代码如下:

public class Test {
    public static void main(String[] args) {
        Cool cool=new Cool();
        Cool.Inner in=cool.new Inner();
    }
}

class Cool {
    private static int info=5;
   
    static class Inner {            //貌似这里编译出错
        public void print() {
            System.out.println(info);
        }
    }
}
搜索更多相关主题的帖子: private public cool 
2015-10-01 23:28
msl12
Rank: 1
等 级:新手上路
帖 子:152
专家分:0
注 册:2015-2-6
得分:0 
好像略懂了一点儿,谢啦!
2015-10-02 11:38



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-457858-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.779333 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved