+ 3
List is an interface where ArrayList is a class that implements the List interface (this is why ArrayList has the List methods). This means List cannot be instantiated. This is not valid! import java.util.*; public class Program { public static void main(String[] args) { List<String> list = new List<>(); // error list.add("try"); list.add("again"); } } More info: https://techdifferences.com/difference-between-list-and-arraylist-in-java.html https://docs.oracle.com/javase/8/docs/api/java/util/List.html https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html
7th Dec 2021, 4:29 AM
ChaoticDawg
ChaoticDawg - avatar
+ 4
Standard Java arrays are of fixed length, which means that once they are created, they cannot be expanded or shrunk. On the other hand, ArrayList classes are created with the original size, but if the size is exceeded, the collection is automatically increased. When objects are removed, the ArrayList may shrink in size. Note that the ArrayList class is in the java.util package, so you must import it before using it.
7th Dec 2021, 4:30 AM
Solo
Solo - avatar
+ 2
there is a vast difference between list and arraylist that are not similar list is mainly used for listing the number of elements in a program where as arraylist this used to Les De dynamic elements of the array
20th Dec 2021, 9:09 AM
Yamima Thapa
Yamima Thapa - avatar