I have 2 Java classes.
- TestLogging
- Test2
In both the classes I have written the same logic. But in TestLogging class, I am not allowed to access non-final variable in anonymous inner class.
But in Test2 class, why am I allowed to access non-final variable in anonymous inner class?
How is it possible to access non-final variable from anonymous inner class?