In one of the question of Bill Brodgen's Mock exam one option is : An annonymous inner class is always assumed to extend Object Answer is false. The explaination given is : Answer is wrong as an annonymous inner class can extend any class, however the declaration syntax does not use the wrod extends. This is not clear to me. Can anybody explain this? Thanks.
Here, you can see that the inner class extends class A. You can verify it by doing : javap Test$1 HTH, Paul. ------------------ Get Certified, Guaranteed! (Now Revised for the new Pattern) www.enthuware.com/jqplus
But aren't all classes subclasses of Object by default. I would think it would be true because any class you create extends Object. I know that for an Annonymous class you have to extend a class or implement an interface, but everything always leads back up to the Object superclass. Am I correct in this?
Enthuware Software Support
Joined: Sep 23, 2000
Well, that is correct but that's not what the author probably meant. I think, he wanted to drive the point that Anonymous class can extend any other class also. -Paul.
------------------ Get Certified, Guaranteed! (Now Revised for the new Pattern) www.enthuware.com/jqplus