- class Outer{
- private static final int b = 0;
- // public static void m() {
- class Inner {
- int a = b; //不报错
- public void fun(){
- System.out.println(b);//输出b
- }
- }
- // System.out.println(b);//不报错
- // }
- public static void print(){
- new Inner().fun() ; //此处错误
- }
- }
- public class Demo6{
- public static void main(String args[]){
- Outer out = new Outer() ;
- out.print() ;
- }
- }
复制代码 |
|