The JavaTM Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form

Trail: Learning the Java Language
Lesson: Object Basics and Simple Data Objects

Arrays

An array is a structure that holds multiple values of the same type. The length of an array is established when the array is created. After creation, an array is a fixed-length structure.

An array with ten elements. Indices begin at 0 and end at the array

An array element is one of the values within an array and is accessed by its position within the array.

Arrays have certain performance characteristics, such as random access in constant time and linear lookup. Other data structures with other characteristics are provided in the Collections Framework, for example HashMap with near-constant time for lookup. The Collections Framework also provides an array-like data structure which supports dynamic resizing, ArrayList. Refer to Collections (in the Learning the Java Language trail) for more information. This section covers the following array-related topics:


Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form

Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.