This is an example of declaring an (non-anonymous) inner class within a method, i.e. yo( ). The rules of applying modifiers to this type of inner class is similar to that of local variables. You cannot marked the this type of inner class with the following modifiers : static, private, protected, public, transient, volatile, native, and synchronized. The only modifiers you are allowed to used on them are : final, abstract and strictfp (and of course without any modifiers at all).
Now My question is if we say "Rules which are applied to local method class is same as rules applied to Local variable" Then how can we apply abstract and strictfp keywords to local method class.
Joined: May 16, 2006
In my opinion abstract and trictfp are class modifiers. Anything that is method local other than a class is a variable declaration and initialization and/or a method call. So a variable cannot have the modifiers: abstract and strictfp, anywhere. Hence the reason.
Joined: May 09, 2006
It should read:
The rules of applying ACCESS modifiers to this type of inner class is similar to that of local variables.
Think about it. A method-local class differs from other types of classes in terms of SCOPING, which is related to ACCESS.
The modifiers "strictfp", "abstract" and "final" have nothing to do with SCOPING and ACCESS. "strictfp" is about floating point arithmatic. "abstract" and "final" are about SUBCLASSING.