Hi. Below is from geekevaluation.com, regarding method local inner class. I know that final variables of methods can only be accessed by its method local inner class. Then why not in below mentioned code?
Here 'a' is a final variable. Still at Line 4, there is a compiler error. Somebody please give me a proper explanation for this. Thanks.
1. Within a class definition only declarations of variables, methods, blocks, etc. are allowed, but no statements like "a = 19;". The follwing example will help: 2. You can't assign a value to a final variable within a local class.