aaload : retrieve object reference from array : index : visitInsn()

Description
Retrieves an object reference from an array of objects and places it on the stack. arrayref is a reference to an array of objects. index is an int. The arrayref and index are removed from the stack, and the object reference at the given index in the array is pushed onto the stack.
Exceptions
NullPointerException - arrayref is null

ArrayIndexOutOfBoundsException - index is < 0 or >= arrayref.length
Example
; This is like the Java code:
;     Object x = arr[0];
; where x is local variable 2 and arr is an array of objects in local variable 1
aload_1       ; load local variable 1 onto the stack
iconst_0      ; push the integer 0 onto the stack
aaload        ; retrieve the entry
astore_2      ; store the entry in local variable 2
Notes
Array indices start at 0 (the first entry in the array is at index 0).
See also
iaload faload daload laload baload caload saload iastore lastore fastore dastore aastore bastore castore sastore
Stack
Before After
index value
arrayref ...
... ...
Bytecode
Type Description
u1 aaload opcode = 0x32 (50)