Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 162
    Mind that you can also import a static nested class directly, i.e. you could do (at the top of the file): import OuterClass.StaticNestedClass; then reference the class just as OuterClass. Commented Jul 16, 2011 at 0:22
  • 2
    So, can I say that 'static nested class' are just top-level classes placed within a class, and that outer class can be considered a 'namespace'. While, 'nested classes' is a member of the outer class and it requires an enclosing instance of the outer class? Commented Jul 6, 2022 at 8:40
  • 2
    It would have been very nice to have an explanation on when to use which, what is the purpose of each and what are the cons and pros of each. Commented Dec 3, 2022 at 13:50
  • can a property in a static inner class can be changed in a multi threaded env? Commented Feb 10, 2023 at 9:22