I agree with Nasir, Local inner class can't be explicitely declared as static, if the method in which it is declared is static then it implicitely becomes static. Even u cant provide any access modifiers. These classes can only access final variables of the enclosing method and r having full accessability for all the variables and method outside the enclosing method ie in that class. For a local inner class which is inside a static method the rule is that it can only access final variables of the enclosing method, and static variables and method of the class. However u cant declare any static variables in a local inner class. Please correct me if i m wrong some where.
For life to be easy, down goes the rule from Mughal & Rasmussen. ---------------------------------------------------------------- Entity Declaration Direct access Ability to context to Context define members ---------------------------------------------------------------- Non-static As non-static All members Only inner class class member in enclosing non-static context Local class In block with All members Only (non-static) non-static in enclosing non-static context context + local final variables. Local class In block with Static members Only (static ) static in enclosing non-static context context + local final variables.
Oops sorry about the scattered collection :-) Hopefully the following turns user friendly. <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252"> <META NAME="Generator" CONTENT="Microsoft Word 97"> <TITLE>Entity</TITLE> </HEAD> <BODY>
Entity Context
Declaration
Direct access to Context
Ability to define members
Non-static inner class
As non-static class member
All members in enclosing context
Only non-static
Local class (non-static)
In block with non-static context
All members in enclosing context + local final variables.
Only non-static
Local class (static)
In block with static context
Static members in enclosing context + local final variables.
Only non-static
</BODY> </HTML>
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.