1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| class Outter {
private int age = 12;
public void Print(final int x) { //这里局部变量x必须设置为final类型!
class Inner {
public void inPrint() {
System.out.println(x);
System.out.println(age);
}
}
new Inner().inPrint();
}
}
public class test1 {
public static void main(String[] args) {
Outter out = new Outter();
out.Print(10);
}
}
|