posted 23 years ago
2) Anonymous inner classes cannot have 'extends' and 'implements' clause.
new BaseClass() {};//A
new ImplementedInterface () {};//B
A creates an anomymous class that extends from BaseClass. Compiler won't accept any extends (not needed) or implements
B creates an anonymous class that implements ImplementedInterface. Compiler wont't accept any extends or implements (not needed)
4) Anonymous inner classes can never have initialization parameter.
4.1)new BaseClass(arg, ..., arg) {}
This calls the constructor BaseClass(arg, ...., arg)
4.2)Another way of initializing an anonymous class
Note the use of a initialization block, and that the parameter to the method must be final to be accessed from the local class
5) Anonymous inner classes cannot be static .
I am not very sure about the explanation:
Given that there is no name you can't place static before it. The same for extends or implements.
SCJP2. Please Indent your code using UBB Code