Sams Teach Yourself Java 2 in 24 Hours

Sams Teach Yourself Java 2 in 24 Hours

By Rogers Cadenhead

Hour 9. Storing Information with Arrays

No one benefited more from the development of the computer than Santa Claus. For centuries, humankind has put an immense burden on him to gather and process information. Old St. Nick has to keep track of the following things:

Computers were a great boon at the North Pole. They are ideal for the storage, categorization, and study of information.

The most basic way that information is stored in a computer program is by putting it into a variable. However, this method is limited to relatively simple usage. If Santa had to give each naughty child his or her own variable name, he'd be working on the program for the next 12 holiday seasons at least, to say nothing of the effect on his jolly disposition.

The list of naughty children is an example of a collection of similar information. Each child's name is a string of text or some kind of Santa Information System ID number. To keep track of a list of this kind, you can use arrays.

Arrays are groups of related variables that share the same type. You can have arrays of any type of information that can be stored as a variable. Arrays can be used to keep track of more sophisticated types of information than a single variable, but they are almost as easy to create and manipulate as variables.

The following topics will be covered during this hour:

Share ThisShare This

Informit Network