How can I specify array with varying length (no specific length)?

In PHP, we can assign associative array with no specific length defined, such as $var['fruit'][] = "apple", the length will be automatically incremented on demand.

While in Java, we have to specify the lengh before we use it, such as:

String[] fruit = new String[10];

I would like to ask sometimes we have to store the information with varying length, what is the alternative method of Java to accomplish this?

[437 byte] By [roamera] at [2007-11-27 5:27:04]
# 1
Use an ArrayList.
camickra at 2007-7-12 14:48:23 > top of Java-index,Java Essentials,Java Programming...