posted 19 years ago
1. An anonymous inner class either extends another class or implements a single interface (without using the keywords extend or implements). The base class need not be the enclosing class (although it could be), and could in fact be Object.
2. Because the anonymous class has no name, it can have no constructor (since constructors must share the name of their classes). However, it can be initialized using initializer blocks.
3. An anonymous class is instantiated by calling the constructor of the class it extends -- with the body of the anonymous class slipped in after the constructor's argument parentheses, but before the semicolon. The result is an instance of the anonymous class automatically upcast to the type of the base class.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org