Final (Java): Difference between revisions

Content deleted Content added
Undid revision 516113307 by 134.91.226.47 (talk)
m Restored text that was mistakenly removed
Line 33:
</source>
 
A common misconception is that declaring a class or method final improves efficiency by allowing the compiler to directly insert the method inline wherever it is called. In fact the compiler is unable to do this because the method is loaded at runtime and might not be the same version as the one that was just compiled. Only the runtime environment and [[Just-in-time compilation|JIT]] compiler have the ideveloperworksinformation about exactly which classes have been loaded, and are able to make better decisions about when to inline, whether or not the method is final.<ref>[http://www.ibm.com/developerworks/java/library/j-jtp1029.html Java theory and practice: Is that your final answer?]</ref>
 
== Final variables ==