Java Magazine, Sept/Oct 2017
ORACLE COM JAVAMAGAZINE SEPTEMBER OCTOBER 2017 50 java 9 is needed when a method is invoked on an object for which only the interface type is known at compile time Note that even though slightly more work is done for the lookup of an interface call you should not try to micro optimize by avoiding interfaces Remember that the JVM has a JIT compiler and it will essentially eliminate any performance difference between the two cases Example of Invoking Methods Lets look at another example Consider this bit of code Cat tom new Cat Bear pooh new Bear Furry f tom groom pooh groom f tom f groom f pooh f groom This code produces the following bytecodes Code 0 new 2 class scratch Cat 3 dup 4 invokespecial 3 Method scratch Cat init V 7 astore_ 1 8 new 4 class scratch Bear
You must have JavaScript enabled to view digital editions.