作者:blindpirate链接:https://www.zhihu.com/question/361639494/answer/948286842来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. TL;DR的回答如下: JLS 15.27.2 提到: The restriction to effectively final variables prohibits access to dynamically-changing local variables, who…
直接上代码 import java.lang.reflect.Field; public class Main { public static void main(String[] args) throws Exception { TestA testA = new TestA(); Class class1 = TestA.class; Field field = class1.getDeclaredField("i&…