go to previous page   go to home page   go to next page
String[] list = new String[3];

Answer:

The array object has three cells.


Fixed-length Array

old array

Once an array object has been constructed, the number of cells does not change. It must be constructed with a length that will accommodate all expected data. Unfortunately, sometimes this length is hard to determine. Depending on the data, the program might need differents sizes each time it is run. It would be nice if there were a type of array that allowed you to keep adding data regardless of its original length.

Vocabulary Review: A cell of an array is a place where data may be stored. An array may contain many cells. The cells are numbered from 0 up to one less than the length of the array. (Sometimes cells are called slots.)

An element is the data that has been placed in a cell. (Sometimes an element is called an item, a value, or an entry.)


QUESTION 2:

An array has been completely filled with information:

String[] list = new String[3];
list[0] = "ant" ;
list[1] = "bat" ;
list[2] = "cat" ;

After running for a while, the program needs to add information to the array. Will the following statement make the array larger?

list = new String[5];