This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 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
jQuery in Action, 3rd edition