Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inner class

 
Khurram Ajmeri
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What class must an inner class extends?? :roll:
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They don't have to extend anything (other than Object).
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They don't have to extend anything (other than Object).
Which is implicit if you don't specify a parent class.
 
manju kumar
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think inner classes can extend any other classes. But there is no must and should that they have to extend some class.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But there is no must ... that they have to extend some class.
Except, as Jim pointed out, the Object class. The Object class is always at the top of any class heirarchy. If you don't explicitly extend some class, then the compiler determines that you must want to extend the Object class directly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic