jQuery in Action, 3rd edition
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Helllp..... Anon Class - Kathy & Bert's CD Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Helllp..... Anon Class - Kathy & Bert Watch "Helllp..... Anon Class - Kathy & Bert New topic

Helllp..... Anon Class - Kathy & Bert's CD

Padma Raman
Ranch Hand

Joined: Mar 31, 2001
Posts: 32
I ahve come across this problem in Kathy & Bert's CD. I could not understand a bit and I am getting error when i try to compile the program also. Can anyone explain?
Question: Given the following:

Which two would create and anonymous inner class from within the class Bang?
A. Bang b = new Bing("Foo") { };
B. Bing b = new Bing(343) { };
C. Bing b = new Bing(){"Foo";};
D.Bing b = new Bang() { };
E. Bing b = new Bing.Bang("Foo") { };
Answer : C & D.
I feel answer A and D are correct; C is not even working for me!!!
Please explain. Moreover thsi software is not good at all. It doesn't let me do even copy and paste at all. It even declares that i failed when scored 77%.

Edited by Corey McGlone: Added CODE Tags
[ March 11, 2004: Message edited by: Corey McGlone ]
Mel Edwards

Joined: Feb 27, 2004
Posts: 8
Answer C is indeed incorrect. It has a typo. For the discussion see here:
Answer A is wrong because it is trying to refer to a superclass using a variable declared as a subclass. It would work fine the other way around, (like answer D in fact) but not this way.
Finally you've got a small transcription error in your code. It should be:
Bang(String bangS) {super(bangS);}
(note the punctuation)
Padma Raman
Ranch Hand

Joined: Mar 31, 2001
Posts: 32
Thanks a lot.
I agree. Here's the link: http://aspose.com/file-tools
subject: Helllp..... Anon Class - Kathy & Bert's CD
It's not a secret anymore!