I have already gone through many links for this answer. And I know that syntactically Java does not allow non-final variables to be accessed in Inner classes. According to this link, I have also understood that making a local-variable final allows it to stay alive even if the method gets completed and local variable goes out of scope.
But if a method goes out of scope how making it final would allow it to be alive for Inner classes where it has been referenced?
I am referring to the below code.
public class Outer {
    public static void outerMethod() {
        int methodVariable = 40;
        class Inner {
            public void innerMethod() {
                System.out.println(methodVariable); // This line produces compile time error.
            }
        }
    }
}
 
    
