When the javac compiler finds a call to B.getName() , it solves it there - and - then - A.getName() and puts the static call A.getName() in the byte code.
In java, there is no mechanism that can output the form used in the source code from byte code.
If you want B.getName() be another A.getName() method, you must define a method called getName() in B Since the called class will always be "B" in this method, there is no need to bypass the stack trace or other mechanisms. However, as a rule, if you think that it was important that it was to the point, it is probably best to use an object-oriented design for you.
source share