Contents | Prev | Next | Index

multianewarray

A new multidimensional array of the array type is allocated from the garbage-collected heap. The components of the array of in the first dimension are initialized to subarrays of the type of the second dimension, and so on. The components of the first dimension of the array are initialized to the default initial value for the type of the components (§2.5.1). A reference arrayref to the new array is pushed onto the operand stack.

Linking Exceptions
During resolution of the CONSTANT_Class constant pool item, any of the exceptions documented in §5.1 can be thrown.

Otherwise, if the current class does not have permission to access the base class of the resolved array class, multianewarray throws an IllegalAccessError.

Runtime Exception
Otherwise, if any of the dimensions values on the operand stack is less than zero, the multianewarray instruction throws a NegativeArraySizeException.

Notes
It may be more efficient to use newarray or anewarray when creating an array of a single dimension.

The array class referenced via the constant pool instruction may have more dimensions than the dimensions operand of the multianewarray instruction. In that case, only the first dimensions of the dimensions of the array are created.


Contents | Prev | Next | Index

Java Virtual Machine Specification (HTML generated by dkramer on February 25, 1997)
Copyright © 1996 Sun Microsystems, Inc. All rights reserved
Please send any comments or corrections to doug.kramer@sun.com