Meaningless Drivel is fun!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes What class must an inner class extend Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "What class must an inner class extend" Watch "What class must an inner class extend" New topic
Author

What class must an inner class extend

Cathy Song
Ranch Hand

Joined: Aug 24, 2003
Posts: 270
4Tests website

3.What class must an inner class extend:
A. The top level class
B. The Object class
C. Any class or interface
D. It must extend an interface

The answer given is C. I think the answer should be B. Since it is not necessary for the inner class to extend a class or implement an interface.
Am I right?
Thanks.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
I'd pick E. Any class.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Mika Leino
Ranch Hand

Joined: Jan 07, 2002
Posts: 56
I'd say C is correct, because the group Any class or interface includes Object. The way I understand option B is "An inner class must extend the Object class.", and that would force us to extend all inner classes from Object.


Mika Leino<br />SCJP, SCWCD
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Dirk is correct because you can't extend an interface unless you are an interface.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Vad Fogel
Ranch Hand

Joined: Aug 25, 2003
Posts: 504
My guess is B because the question says must. The only must for classes inheritance is Object, all the rest is optional.
mohana konakanchi
Ranch Hand

Joined: May 16, 2001
Posts: 67
3. What class must an inner class extend:
A. The top level class
B. The Object class
C. Any class or interface
D. It must extend an interface

Anonimous InnerClass should extend atleast one class or implement atleast one interface. Where as for inner class with name it's not manditory to extends any class(By default extends Object) or implement an interface.
Since anonimous inner Class also an inner class,Both B and C are correct.
If we go by words "extend" and "implement:, Question askes for extend only so B is correct.
I guess I am confused with ambious quesiton itself.
May we need a GURU now.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Answer: the question is poorly worded and needs to be rewritten. One of the problems with the mock exams is that they haven't gone through the same level of quality control as the real thing. Don't expect to get poorly worded questions like that one on the real test.
Cathy Song
Ranch Hand

Joined: Aug 24, 2003
Posts: 270
Thanks for all your inputs.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What class must an inner class extend