This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes inner class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "inner class " Watch "inner class " New topic

inner class

prasanna pati
Ranch Hand

Joined: Jan 29, 2005
Posts: 46
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

Joined: Sep 16, 2005
Posts: 1780

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.

There is no emoticon for what I am feeling!
I agree. Here's the link:
subject: inner class
It's not a secret anymore!