菜鸟求助,lambda表达式使用问题
static { Thread t1 = new Thread(new Runnable() { @Override public void run() { System.out.println(abc); //works } }); Thread t2 = new Thread(() -> { System.out.println(abc); //illegal forward reference }); t1.start(); t2.start(); } private static String abc = "test"; //declare after static block public static void main(String args[]) { System.out.println("main:" + DataAnalyseTest.abc); }第一种声明方式为什么可以使用后面的静态变量但是第二种不可以。。。#Java#