• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

///inner class///

 
chao-long liao
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JohnJuntMockExam...
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
Select the most appropriate answer.
my answer is b,but the answer is c ???
can somebody tell me why ???
the answer is wrong ??
liao
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

my answer is b,but the answer is c ???
can somebody tell me why ???

The question was: "What class must an inner class extend." An inner class is not forced to extend Object.
Also, an inner class need not extend the enclosing class, nor an interface (though it can, if wants to).
 
chao-long liao
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question was: "What class must an inner class extend." An inner class is not forced to extend Object.
Also, an inner class need not extend the enclosing class, nor an interface (though it can, if wants to).

Thanks,I can get what you say,but how about c,
inner class "must" extend any class or interface??
So we can say it's not a good question,right ?
It's ambiguous.
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right there
 
Thiru Thangavelu
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess the question expects the answer about anonymous inner class where it must extend a class or implememt an interface(though it is not mentioned there).
[ June 20, 2002: Message edited by: Thiru Thangavelu ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic