publicclass MainClass {
publicstaticvoid main(String[] argv) {
int i = 0;
class MyClass {
void m() {
System.out.println(i);
}
}
}
}
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Cannot refer to a non-final variable i inside an inner class defined in a different method
at MainClass.main(MainClass.java:8)