About us

Join us FREE!

Differences between String[] and listArray

Tutorial by Er Satya connectclue-author-image

All > Tech Blogger | Java | Spring Boot | HTML | CSS | MySQL > Java | Spring Boot

1 like

Please login to like this article.

connectclue-linkedin-share

Differences between String[] and ArrayList

String[] is an array of Strings while ArrayList is a generic class that takes different types of objects. Therefore we can only perform normal array operations with String[]. However, we can use additional, convenient utilities such as isEmpty(), iterator, etc with ArrayList since it also implements Collection Interface.

ArrayList has some neat methods, such as add(), remove(), and contains().

An array String[] cannot expand its size. You can initialize it once giving it a permanent size:

String[] myStringArray = new String[10]();
myStringArray[0] = "Test";
An ArrayList is variable in size. You can add and remove items dynamically:
ArrayList myStringArrayList = new ArrayList();
myStringArrayList.add("Test");
myStringArrayList.remove(1);
Furthermore, we can sort, clear, addall, and a lot more functions and can use while using an ArrayList. 


connectclue-linkedin-share

More articles:


Recent lost & found:


Login for enhanced experience

connectclue-tick Create and manage your profile

connectclue-tick Refer an author and get bonus Learn more

connectclue-tick Publish any lost and found belongings

connectclue-tick Connect with the authors & add your review comments

connectclue-tick Join us for Free to advertise for your business or Contact-us for more details

connectclue-tick Join us for Free to publish your own blogs, articles or tutorials and get your Benefits

connectclue-login

Back to top