Dan's exam Study Guide/mughal/chapter7/exam1.html
Q-14
Which of the follow are true statements.
a. An anonymous class can extend only the Object class.
b. An anonymous class can not implement an interface.
c. An anonymous class can be abstract.
d. An anonymous class is implicitly final.
e. An anonymous class can be static.
f. The class instance creation expression for an anonymous class must never include parameters.
g. An anonymous class must declare at least one constructor.
h. None of the above.
By going through the Mughal book I thought option e is true.
Section 7.1 Overview of Nested Classes- Pg224
Local and anonymous classes can be either static or non-static, where being non-static means that an instance of such a class is associated with an instance of the enclosing class.
But JLS (and according to Dan too) says
15.9.5 Anonymous Class Declarations
An anonymous class is never abstract (�8.1.1.1). An anonymous class is always an inner class (�8.1.2); it is never static (�8.1.1, �8.5.2). An anonymous class is always implicitly final (�8.1.1.2).
Can someone let me know what will be the right answer for exam point of view ?
Is Khalid Mughal wrong in saying that local and anonymous classes which are defined in static context can be said to be static local and static anonymous classes ?