General discussion

Locked

Nested Class & Inner Class

By itramaraj ·
What is (are) the difference between Nested class and inner class in Java?

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by itramaraj In reply to

Poster rated this answer.

Collapse -

by screwmail In reply to Nested Class & Inner Clas ...

Nested classes are simply static inner classes. The difference between nested classes and inner classes is the same as the difference between static and nonstatic members of a class: nested classes are associated with the enclosing class itself, whereas inner classes are associated with an object of the enclosing class.

Because of this, inner class objects require an object of the enclosing class, while nested class objects do not. Nested classes, therefore, behave just like top-level classes, using the enclosing class to provide a package-like organization. In addition, nested classes have access to all members of the enclosing class.

Collapse -

by itramaraj In reply to

Poster rated this answer.

Collapse -

by itramaraj In reply to Nested Class & Inner Clas ...

This question was closed by the author

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums