Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

nested class and inner class

 
Abhishek Reddy
Ranch Hand
Posts: 259
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the difference between nested class and inner class?
 
Marilyn de Queiroz
Sheriff
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This story about inner classes might give you some insight.
 
Jean-Francois Briere
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a very simple yet complete summary of the picture about nested/inner classes:
nested classes

Regards
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic