Bytecode
Type | Description |
u1 | caload opcode = 0x34 (52) |
Stack ..., arrayref, index =>..., value
Description
Retrieves a character from an array of characters and pushes it on the operand stack.
The arrayref must be of type reference
and must refer to an array
whose components are of type char
.
The index must be of type int
. Both arrayref and index
are popped from the operand stack.
The char
value in the component of the array at index is
retrieved, zero-extended to an int
value, and pushed onto the top of
the operand stack.
Example
; This is like the Java code: ; char x = arr[0]; ; where x is local variable 2 and arr is a ; char array in local variable 1 aload_1 ; load local variable 1 onto the stack iconst_0 ; push the integer 0 onto the stack caload ; retrieve the entry istore_2 ; store the entry in local variable 2
Exceptions NullPointerException - arrayref is null
ArrayIndexOutOfBoundsException - index is < 0 or >= arrayref.length