标签: jvm
当目标方法静态知道时(即使它不是静态方法),java编译器(javac或eclipse)尝试将方法调用编译为静态。例如
class A { void foo() { doStuff(); } } ... A a = new A(); a.foo(); // is this compiled as virtual call or static call?
答案 0 :(得分:1)
请参阅我在How to find out what optimizations the JVM applied to my code?