The following is the simplest example of a static inner class in Java. Let's take a look at that.
package staticclass; final class Outer { final public static class Inner { static String s = "Black"; } static Extra Inner = new Extra();
In the Outer class, there is a static class with the name Internal and a static object with the same name Internal of type Extra. The program displays Whitte on the console, a line in the Extra class through Outer.Inner.s in main (), which is designed to display the line contained in the Internal class in the External class
Why are there no name clashes between a static inner class and a static Extra object? How does the Extra class take precedence over the Internal class and display the string contained in the Advanced class?
Lion
source share