Here's a question I've wondered for some time, so I thought I would just ask to see if anyone had a good answer.
When you create an inner class, you can make it either static or instance-specific. e.g.
which gets created via new MyOuterClass.MyIterator() versus
which gets created via new MyOuterClass().MyIterator()
Simply asked, are there situations where it's better to use a static inner class, and situations where it's better to use the instance-based approach? I find myself always using static inner classes, since it's easier to invoke, but I wonder if I'm missing some drawbacks I might be incurring. [ November 10, 2005: Message edited by: dave taubler ]
Dave Taubler<br />Specializing in <a href="http://taubler.com/articles/" target="_blank" rel="nofollow">Java and Web Development</a>
(Non static) Inner classes have full access to any (even private) members of its enclosing class instance. Static inner classes (actually Nested classes) can only access static members of its enclosing class.