I know this is a bit of a duplicate question but I want to ask it in a very specific way in order to clarify a very important point. The primary question being: Is there any
A subtle difference is that a nested class has the ability to shadow members of the enclosing type:
class ContainingClass {
public static String privateStaticField = "a";
static class ContainedStaticClass {
public static String privateStaticField = "b";
public static void main(String[] args) {
System.out.println(privateStaticField); // prints b
}
}
}
But that's also related to the scope of the class.