I\'m reading up some material on whether Java can be faster than C++, and came across the following quote:
Java can be faster than C++ because JITs can in
Since compilation of Java bytecode into machine code is deferred until runtime, it is possible for JVMs to perform profile-guided optimization and other optimizations that require information not available until code is running. This may even include "deoptimization", where a previously made optimization is revoked so that other optimizations can occur.
More information about this can be found under adaptive optimization on Wikipedia, which includes optimizations related to inlining.