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?
Asked
Active
Viewed 98 times
0
-
One example could be the ArrayList implementation - java.util.ArrayList. It contains several inner classes implementing the java.util.Iterator interface. There are factory methods that return new instances of these inner classes. – mishless Mar 21 '18 at 11:43
1 Answers
1
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.

Alex Evseenko
- 122
- 1
- 5
-
Thanks for your answer. I also found a few examples in java.lang package: Character, ProcessBuilder, Thread; Other ones java.net.Proxy, java.util.ResourceBundle, java.util.Formatter, ... – koniga-ganica Mar 25 '18 at 15:06