I am studying ArrayList and I know that I can do "arrayList.add(12); arrayList.add(8); ..." to add integers in the array List but are there any way that I can put all the integers(12, 8, 21, 95, 27) with a line of code?
import java.util.ArrayList;
public class ArayList {
public static void main(String[] args) {
ArrayList<Integer> arrayList = new ArrayList<Integer>();
System.out.println();
arrayList.add(12, 8, 21, 95, 27);
}
}