• Post Reply Bookmark Topic Watch Topic
  • New Topic

What is the use of Inner classes in OO perspective?  RSS feed

 
Birla Murugesan
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the use of Inner classes in OO perspective?
 
Martin Vanyavchich
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You limit visibility. If your class is used by only one other class, it makes sense to make it an inner class and by this, possibly, hiding it's implementation.
 
Rajesh Nagaraju
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Inner classes are useful for creating helper classes that depend on the outer classes.
Eg: Iterators
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!