COMPUTERS GET A LOT OF THEIR POWER from working with data structures. A data structure is an organized collection of related data. An object is a data structure, but this type of data structure -- consisting of a fairly small number of named instance variables -- is just the beginning. In many cases, programmers build complicated data structures by hand, by linking objects together. We'll look at these custom-built data structures in Chapter 11. But there is one type of data structure that is so important and so basic that it is built into every programming language: the array.
An array is a data structure consisting of a numbered list of items, where all the items are of the same type. In Java, the items in an array are always numbered from zero up to some maximum value, which is set when the array is created. For example, an array might contain 100 integers, numbered from zero to 99. The items in an array can belong to one of Java's primitive types. They can also be references to objects, so that you could, for example, make an array containing all the components in an applet.
This chapter discusses how arrays are created and used in Java. It also covers the standard class java.util.ArrayList. An object of type ArrayList is very similar to an array of Objects, but it can grow to hold any number of items.
[ First Section | Next Chapter | Previous Chapter | Main Index ]
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Java Programming: Chapter 8 Index
Post your Comment