126.

prev next contents
aastore

store object reference in array

Jasmin Syntax
     aastore 
Stack

Before

After
value
...
index

arrayref

...

Description

This stores an object reference it in an array of objects. arrayref is a reference to an array of object references. index is an int. value is the object reference to be stored in the array. arrayref, index and value are removed from the stack, and value is stored in the array at the given index.

The runtime type of value must be assignment-compatible with the type of the array. For example, if the array is declared as an array of Threads, then value must either be null or an instance of Thread or one of its subclasses. An ArrayStoreException is generated if you attempt to store an incompatible type of object in an array. Assignment compatibility is described in more detail in Chapter 7.

Exceptions

ArrayIndexOutOfBoundsException - index is < 0 or >= arrayref.length

ArrayStoreException - value is not compatible with the type of the array

NullPointerException - arrayref is null

Bytecode

Type

Description
u1
aastore opcode = 0x53 (83)
See Also

iastore, lastore, fastore, dastore, bastore, castore, sastore, iaload, laload, faload, daload, aaload, baload, caload, saload

Notes

Array indices start at 0 (the first entry in the array is at index 0).


prev next contents
Java Virtual Machine, by Jon Meyer and Troy Downing, O'Reilly Associates


Java Virtual Machine
Java Virtual Machine (Java Series)
ISBN: 1565921941
EAN: 2147483647
Year: 1996
Pages: 171

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net