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 (at runtime). 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.

If you want to store data of different types in a single structure, or if you need a structure whose size can change dynamically, use a Collection implementation, such as ArrayList, instead of an array. Refer to Collections (in the Learning the Java Language trail) for a complete trail on the subject. 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.