File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes nested class and inner class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "nested class and inner class" Watch "nested class and inner class" New topic

nested class and inner class

Abhishek Reddy
Ranch Hand

Joined: Mar 28, 2006
Posts: 259
what is the difference between nested class and inner class?

Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9059
This story about inner classes might give you some insight.

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Jean-Francois Briere
Ranch Hand

Joined: Mar 03, 2004
Posts: 101
Here is a very simple yet complete summary of the picture about nested/inner classes:
nested classes

marc weber

Joined: Aug 31, 2004
Posts: 11343

Be aware that these terms are not always used consistently, especially in older material. (Surprisingly, Eckel's Thinking in Java is still not in agreement with the Java Language Specification.)

According to the current JLS...

"A nested class is any class whose declaration occurs within the body of another class or interface." (JLS 8)

"An inner class is a nested class that is not explicitly or implicitly declared static." (JLS 8.1.3)
[ August 27, 2006: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
I agree. Here's the link:
subject: nested class and inner class
jQuery in Action, 3rd edition