标签:static bsp return oid style rgs enc obj ref
可以参考JLS7:https://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.3.2.3
public class Test5 { int a = m1(); public int m1() { System.out.println(i); // 0 return i; } int b = (new Object() { public int t() { System.out.println(i); // 0 return i; } }).t(); { i = 100; System.out.println(this.i); // 100 //i = i+1; // error Cannot reference a field before it is defined //System.out.println(i); // error Cannot reference a field before it is defined } //int k = i+1; // error Cannot reference a field before it is defined int i = 2; public static void main(String[] args) { Test5 t = new Test5(); System.out.println(t.i); // 2 } }
标签:static bsp return oid style rgs enc obj ref
原文地址:http://www.cnblogs.com/extjs4/p/7771573.html