O'Reilly logo

Special Edition Using Java 2 Standard Edition by Geoff Friesen, Chuck Cavaness, Brian Keeton

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

Arrays

Now that you have an understanding of the primitive types, let's turn our attention to one of the reference types. Recall the three reference types in Java:

  • Classes

  • Interfaces

  • Arrays

Classes and interfaces are complex enough to earn their own chapters, but arrays are comparatively simple, so they are covered here with the primitive types.

An array is simply a way to maintain a sequence of items. Arrays are objects that hold a fixed number of variables of the same type. Arrays can hold primitive types, other objects, or even references to other arrays. If you have data that can be easily indexed and the number of data elements is known in advance, you should definitely consider using an array. Alternatives to arrays are described in Chapter ...

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