| Article: |
Nested Classes, Part 1 | |
| Subject: | static inner class | |
| Date: | 2004-06-21 06:41:15 | |
| From: | pzikos | |
| i understand the concept of inner classes and i have used them a lot in my programs. yet why would somebody declare a static inner class and not create another class? | ||
Showing messages 1 through 1 of 1.
-
static inner class
2004-06-21 07:11:08 Robert Simmons, Jr. |
[View]
Oh, that is easy. Compositional relationships. For example, consider an entry in a Hashtable. The entry itself cannot exist outside of the hashtable. Nor is there any reason for users of the table to access the class. Therefore, a private static nexted class is the perfect answer.


