JVM Knowledge

The following steps are used to create the array class C denoted by the name N in association with the class loader L. L may be either the bootstrap class loader or a user-defined class loader.

First, the Java Virtual Machine determines whether L has already been recorded as an initiating loader of an array class with the same component type as N. If so, this class is C, and no array class creation is necessary.

Otherwise, the following steps are performed to create C:

  1. If the component type is a reference type, the algorithm of this section (§5.3) is applied recursively using L in order to load and thereby create the component type of C.

  2. The Java Virtual Machine creates a new array class with the indicated component type and number of dimensions.

    If the component type is a reference type, the Java Virtual Machine marks C to have the defining loader of the component type as its defining loader. Otherwise, the Java Virtual Machine marks C to have the bootstrap class loader as its defining loader.

    In any case, the Java Virtual Machine then records that L is an initiating loader for C (§5.3.4).

    If the component type is a reference type, the accessibility of the array class is determined by the accessibility of its component type (§5.4.4). Otherwise, the array class is accessible to all classes and interfaces.