Java Magazine, Mar/Apr 2018
ORACLE COM JAVAMAGAZINE MARCH APRIL 2018 74 inside the jvm at location indexed by value capability All heap access is done by field name or array index relative to a base object The relevant JVM bytecodes corresponding to these operations include getfield and putfield Now consider the following bit of Java code public class Rect private int w private int h public Rect int w int h this w w this h h public int area return w h public boolean sameArea Rect other return this area other area public static void main final String args java util Random rand new java util Random int sameArea 0 for int i 0 i 100_ 000_ 000 i Rect r1 new Rect rand nextInt 5 rand nextInt 5 Rect r2 new Rect rand nextInt 5 rand nextInt 5
You must have JavaScript enabled to view digital editions.