| Author |
Nested classes
|
Stephen Adams
Greenhorn
Joined: Mar 18, 2002
Posts: 22
|
|
Hi, This is my first time posting on JavaRanch, great site by the way. My question is about Nested Classes, I know what they are and how they are created, but why would you used them instead of creating a new SubClass?
|
 |
Anthony Villanueva
Ranch Hand
Joined: Mar 22, 2002
Posts: 1055
|
|
Bruce Eckel has an interesting discussion on inner classes. According to him, inner classes allow you to hide a class that implements an interface. You can also use an inner class if you want to create a class "on the fly".
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
|
Also, an instance of an inner class would have access to the private members of the enclosing class. An instance of a subclass would not have access to the private members of the superclass instance.
|
[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
|
 |
 |
|
|
subject: Nested classes
|
|
|