We know some of this syntax won't compile, specifically the line where I'm explicitly referring to the class name for a variable.class Main {    static String Main.s1 =output; //won't compile    static String s2 = output;    public static void main(String... s1) {        System.out.println(output);    }}The Main.s1 =output; gives a compiler error. But we do know that the following is ok:class Main {    static String s2 = output;    public static void main(String... s1) {        System.out.println(Main.s2);    }}Similarly, the following is also ok.class Main {    static String s2 = output;    public static void main(String... s1) {        Main.s2 = baz;        System.out.println(Main.s2);    }}It's just at declaration that the compilers complains. I read that there are these rules for identifiers in Javareserved words cannot be used. they cannot start with a digit butdigits can be used after the first character (e.g., name1, n2ame arevalid). they can start with a letter, an underscore (i.e., _) or adollar sign (i.e., $). you cannot use other symbols or spaces(e.g., %,^,&,#).So apparently it is not legal to use a dot in an identifier. I agree is it unnecessary, but there is a lot of other unnecessary legal code. Any reason why the dot is illegal in a Java identifier?
Why is the dot illegal in a Java identifier?
java;syntax
The dot is used to denote the end of one identifier and the start of a sub-item of that identifier:package1.package2.class.innerclass.methodWhen the compiler reaches each ., it knows it's reached the end of one identifier and is moving on to the next. If dots were allowed in names, then the method might actually be called innerclass.method. If you then also have a class called class.innerclass in package1.package2 and a class called innerclass in class, then how is the compiler to resolve what it is that you are referring to?