File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

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!
subject: inner class