(1) An anonymous class can extend only the Object class (2) An anonymous class can not implement an interface (3) An anonymous class can be abstract (4) An anonymous class is implicitly final-answer (5) An anonymous class can be static (6) The class instance creation expression for an anonymous class must never include parameters (7) An anonymous class must declare at least one constructor (8) None of the above
I think the answer is 4 & 6. But the real answer is 4 only. Why 6 is not a right answer ?
i think you are right and that the test question should allow for two choices(4 and 6), not just the one. [ September 07, 2007: Message edited by: Michael Raymond Jr. ]
Scooby Snacks for everyone...<br /> <br />SCJA, SCJP 1.4
Here s a quick code going through which hopefully will make your doubts about point(6) clear....
Though, If the class you are extending by annonymous class doesn't have any constructor other than the default one, you can not define any new constructor etc etc.... as you already know. [ September 07, 2007: Message edited by: B Misra ]
yes as if the class being extended have constructor with arguments, you can use those constructor while calling 'new' and defining annonymous class.....
you might want to run that code & try it out yourself.... will help you understand more clearly....