CoreJava/exp5/Outer.java

22 lines
457 B
Java
Raw Normal View History

2024-05-09 09:10:51 +08:00
package exp5;
class Outer {
public int num = 10;
class Inner {
public int num = 20;
public void show() {
int num = 30;
System.out.println(num);
System.out.println(this.num);
System.out.println(Outer.this.num);
}
}
public static void main(String[] args){
Outer outer = new Outer();
Outer.Inner inner = outer.new Inner();
inner.show();
}
}