本帖最后由 cyc523633157 于 2014-8-4 22:10 编辑
- package com;
- import com.cer.Outer.Inner;
- class Outer{
- private static String info = "hello world!!!";
- static class Inner{//使用static第一内部类为外部类
- public void print(){
- System.out.println(info);
- }
- }
- }
- public class InnerClassDemo03 {
- public static void main(String[] args) {
- new Outer().Inner().print();//访问内部类
- }
- }
复制代码 为什么这样访问内部类,Inner()会不行?会报错?
|