String[] list = new String[5]; A good answer might be:The array object has five slots. |
Fixed-length ArrayOnce an array object has been constructed, the number of slots 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 guess the correct length in advance. It would be nice if there were a kind of array where you could keep adding data no matter what length it was originally. |
QUESTION 2:Say that an array has been declared and completely filled with information: After running for a while, the program needs to add information to the array. Will the following statement make the array larger?String[] list = new String[3]; list[0] = "ant" ; list[1] = "bat" ; list[2] = "cat" ; Click Here after you have answered the questionlist = new String[5]; |