How do you create an ArrayList in Java?

To create an array list in Java, you declare an ArrayList variable and call the ArrayList constructor to instantiate an ArrayList object and assign it to the variable : ArrayList friends = new ArrayList(); You can optionally specific a capacity in the ArrayList constructor: ArrayList friends = new ArrayList(100);

Read more