The question of static/final wouldn't arise for an anonymous inner class as you are creating the object on the same line as the class is declared. And for any further subclassing this class is not available. The class scope ends in the very same line. For the above reason for anonymous class you can't use strictfp/public/protected/private/abstract also.
>>is an anonymous class in a static method static??? No, an anonymous class is always an inner class. It is never static. (JLS 15.9.5) However, if an anonymous class is declared in a static method, the JLS says the anonymous class �occurs in a static context�. Therefore, the class has no reference to an object of the enclosing class and cannot access instance fields and methods of the enclosing class. (JLS 8.1.2) [ March 18, 2003: Message edited by: Marlene Miller ]
Let's compare anonymous classes, one declared in a static method, another in a non-static method.
javap -private Test$1
javap -private Test$2
Notice how the second anonymous class has a field that refers to a Test object. The compiler added that field so that the anonymous class can access instance methods and instance fields of the Test object. [ March 18, 2003: Message edited by: Marlene Miller ] [ March 18, 2003: Message edited by: Marlene Miller ]