Are Java arrays class instances?

There is no contradiction. An array is also an Object, albeit a special kind of Object.
It is like saying: An bird is also an animal, albeit a special kind of animal.

You can convince yourself by compiling and running the following Java code.

    String[] arrayOfStrings = { "bla", "blah" };
    
    // examine the class hierarchy of the array 
    System.out.println("arrayOfStrings is of type "
            + arrayOfStrings.getClass().getSimpleName()
            + " which extends from "
            + arrayOfStrings.getClass().getSuperclass().getSimpleName());
    
    // assingning the array to a variable of type Object
    Object object = arrayOfStrings;

The output will be

arrayOfStrings is of type String[] which extends from Object

Arrays are special classes provided to you by Java itself. All of them inherit from common superclass Object. As they inherit from Object they of course can be used anywhere where Object is expected. Instances of arrays are indeed instances of those classes. One can even reference array classes as they do with other classes' literals:

    Class<int[]> intArrayClass = int[].class;

I see no conflict.

This can be useful https://docs.oracle.com/javase/specs/jls/se7/html/jls-10.html#jls-10.8

Tags:

Java

Oop

Arrays

Jls