Search code examples
javainner-classesanonymous-classlocal-class

Examples of inner, nested, local and anonymous classes from JDK, JRE


I find a very useful to read this question: Java inner class and static nested class, but can't find there any example from Java. Could you provide me with real examples of using those classes from JDK, JRE?


Solution

  • Nested classes (static inner) do not have a reference to outer context. Map#Entry is an example of such nested class -- it contains only key, value pair properties and by definition has no access to outer Map implementation.