public class InnerClassAccessFinalVar {
public static void main(String[] args) {
int i = 42;
// i = 100;
class Inner {
public void test() {
System.out.println(i);
}
}
Inner inner = new</
【专题讨论】为什么Java内部类只能访问final修饰的外部局部变量?
![](https://img-home.csdnimg.cn/images/20240711042549.png)