Possible Duplicate:
Are static inner classes a good idea or poor design?
Java supports static inner classes, what the designer of language must have thought when they added it, what real world issues it solves?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Static inner classes are useful when you want the inner class to be “logically scoped” within the outer class (i.e. because it is closely related to the outer class and does not make sense on its own), but don’t need the “code scope” features of regular inner classes i.e. there are no private fields or methods of the outer class that the inner class needs to access, and instances of the inner class don’t logically belong to a specific outer class instance.
For example,
AbstractMaphas a static inner classSimpleEntrythat represents a map entry. Since a map entry does not need access to the map that contains it, it can be static.