O'Reilly logo

OCA Java SE 8 Programmer I Certification Guide by Mala Gupta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required