Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inner class

 
prasanna pati
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Inner may be -> a class inside a class AND a class inside a method . So what is the difference between the two ?
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scope.

A class defined inside a method can access final variables, including local
ones. A member class can't access final local variables of a method.

Also, defining a local class inside a method gives the class name local
scope so that it can't be referenced elsewhere. It becomes an implementation
detail of the method.

 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic