Java8InAction_Chapter02
1 public class MeaningOfThis { 2 public final int value = 4; 3 public void doIt() { 4 int value = 6; 5 Runnable r = new Runnable(){ 6 public final int value = 5; 7 public void run(){ 8 int value = 10; 9 System.out.println(this.value); 10 } 11 }; 12 r.run(); } 13 public static void main(String...args) { 14 MeaningOfThis m = new MeaningOfThis(); 15 m.doIt(); //输出多少 16 } 17 }
答案:5