posted 19 years ago
All inner classes are also considered nested. I'm guessing you're asking if it's better to use inner classes or static nested classes. I'd say that if you don't need to access an outer "this" reference then static nested is simpler, and easier for others (especially beginners) to understand. But if you have a legitimate use for an outer this reference, go ahead and use an inner class instead. In other words, use "static" in the class declaration unless and until your compiler complains, then change it if necessary.
Alternately if your (inner/nested) class is really short and simple, you might just want to declare it as an anonymous class instead - which is a kind of inner class, not static. Anonymous classes can be relatively compact, which is nice if the class is really simple.
"I'm not back." - Bill Harding, Twister