Like the title, I would like to know the differences between String[] and ListArray[String], are they same to some extent.
3 Answers
An array String[] cannot expand its size. You can initialize it once giving it a permanent size:
String[] myStringArray = new String[20]();
myStringArray[0] = "Test";
An ArrayList<String> is variable in size. You can add and remove items dynamically:
ArrayList<String> myStringArrayList = new ArrayList<String>();
myStringArrayList.add("Test");
myStringArrayList.remove(0);
Furthermore, you can sort, clear, addall, and a lot more functions you can use while using an ArrayList.
String[] is an array of Strings while ArrayList is a generic class which takes different types of objects (here it takes Strings). Therefore you can only perform normal array operations with String[]. However, you can use additional, convenient utilities such as isEmpty(), iterator, etc with ArrayList since it also implements Collection Interface.