Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

What class must an inner class extend

 
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd pick E. Any class.
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dirk is correct because you can't extend an interface unless you are an interface.
 
Ranch Hand
Posts: 504
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My guess is B because the question says must. The only must for classes inheritance is Object, all the rest is optional.
 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 270
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for all your inputs.
 
Barry's not gonna like this. Barry's not gonna like this one bit. What is Barry's deal with tiny ads?
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic