A new array of integers is created at execution time by the operation
newarray intThe size of the array should be on the stack before this operation is performed; the operation leaves on the stack a reference to the array. References are distinct from the arithmetic types (int, long, etc.). They are loaded and stored with the operations
aload varThus the Java code
int x= new int ;would be translated (if x was local variable 2) into
ldc 8Elements of an integer array are loaded and stored by the operations
ialoadIn each case, the second element on the stack should be a reference to the array, and the top of the stack the index into the array. Thus, if local variable 2 holds a reference to array x, the sequence
aload 2would put x on top of the stack.
Finally, if an array reference is on the top of the stack, the operation
arraylengthwill leave the length of the array on top of the stack.