4.3.8. Members of an array
Array objects have the following public members:
- length—The public variable length stores the number of elements of the array.
- clone()—This method overrides the method clone defined in the class Object but doesn’t throw checked exceptions. The return type of this method is the same as the array’s type. For example, for an
array of type Type, this method returns Type.
- Inherited methods— Methods inherited from the class Object, except the method clone.
As mentioned in the earlier section on the String class, a String uses the method length() to retrieve its length. With an array, you can use the array’s variable length to determine the number of the array’s elements. In the exam, you may be tricked by code ...