creating an array list in java code example
Example 1: how to create a list in java
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
class scratch{
public static void main(String[] args) {
List aList = new ArrayList<>();
List lList = new LinkedList<>();
}
}
Example 2: how to make an arraylist java
ArrayList integerArray = new ArrayList();
ArrayList stringArray = new ArrayList();
ArrayList doubleArray = new ArrayList();
//... keep replacing what is inside the <> with the appropriate
//data type
Example 3: how to make a new arraylist java
ArrayList name = new ArrayList();
Example 4: java how to create arraylist
import java.util.ArrayList;
//create ArrayList
ArrayList arrayList = new ArrayList();