class Outer{
private int x=3;
static class Inner1{
public void function(){
System.out.println("x1="+x);
}
}
static class Inner2{
static void fun(){
System.out.println("x2="+x);
}
}
public void method(){
new Outer.Inner1().function();
}
}
public class InnerClass {
public static void main(String[] args) {
Outer outer=new Outer();
outer.method();
Outer.Inner2.fun();
}
}
|
|