String[] list = new String[5];
The array object has five cells.
Once an array object has been constructed, the number of cells will not change. If an array object is to be used for the entire run of a program, its length must be large enough to accommodate all expected data. It is often hard to determine the correct length in advance. 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.
Say that an array has been declared and 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];