Now when you instantiate the Fun class, reference variable m will be assigned a null value, because that's the default value for instance and class reference variables.
However I think that, in this way, we define a reference variable which points to a null value (default value for reference variables)
In case of variables, static methods, and private instance methods, this decision is made by the compiler. Why? Nothing special here. It is a rule of Java language. The compiler will decide which member will be used by an expression. The JVM simply uses that particular member as per compiler's decision. How does the compiler decide? Compiler has no knowledge about the actual objects referred to by a variable, right? (Because actual objects are created by by the JVM at run time.) Compiler does have an fair idea but it doesn't know that for sure. So obviously, it cannot decide based on the object type. All it is left with is the variable type.