aaload 0x32
Pops an array and an index; pushes the reference element.
- Opcode
0x32(50)- Family
- Arrays
- Operands
- none
- Length
- 1 byte
- Operand stack
…, arrayref, index → …, value (reference)- Can throw
NullPointerException,ArrayIndexOutOfBoundsException
What it does
Pops an array (reference array) and an index; pushes the element at that index.
The element type is not known from the instruction; the verifier tracks it from the array's type. javac adds a checkcast after it when the source type needs one, for example with generic arrays.
How often javac uses it
In JDK 25.0.5's java.base module, aaload appears 8,966 times in 800 of its 7,391 classes: 0.46% of all instructions, the 45th most common of 194 opcodes in use. Some of the methods that use it: java.io.File.normalizedList, java.io.ObjectInputFilter$Config$Global.<init>, java.io.ObjectInputStream.resolveProxyClass, java.io.ObjectInputStream$FieldValues.<init>.
Examples
From the sample classes, compiled by javac 25 with -g. Each Java line is shown above the bytecode it compiled to; aaload is highlighted.
public static void main(String[] args) in Hello, compiled by javac 25String who = args.length > 0 ? args[0] : "world";System.out.println("Hello, " + who + "!");}static int arrays(int n) in Tour, compiled by javac 25z[0] = true; b[0] = 1; c[0] = 'a'; s[0] = 2; i[0] = 3; l[0] = 4; f[0] = 5; d[0] = 6; str[0] = "x"; grid[0][0] = 7;return (z[0] ? 1 : 0) + b[0] + c[0] + s[0] + i[0] + (int) l[0] + (int) f[0] + (int) d[0] + str[0].length() + grid[0][0] + grid.length;Related instructions
aastore Pops an array, an index and a reference value; stores the value in the array.arraylength Pops an array; pushes its length.anewarray Pops a length; pushes a new array of references.
Specification: JVMS §6.5, aaload (Java SE 25).