10.7. Array Members

The members of an array type are all of the following:

• The public final field length, which contains the number of components of the array. length may be positive or zero.

• The public method clone, which overrides the method of the same name in class Object and throws no checked exceptions. The return type of the clone method of an array type T[] is T[].

A clone of a multidimensional array is shallow, which is to say that it creates only a single new array. Subarrays are shared.

• All the members inherited from class Object; the only method of Object that is not inherited is its clone method.

An array thus has the same public fields and methods as the following class:

class A<T> implements Cloneable, java.io.Serializable ...

Get The Java® Language Specification, Java SE 7 Edition, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.