adding items to an arraylist

Solutions on MaxInterview for adding items to an arraylist by the best coders in the world

showing results for - "adding items to an arraylist"
Stan
19 Aug 2016
1import java.util.ArrayList;
2
3public class Main {
4  public static void main(String[] args) {
5    ArrayList<String> cars = new ArrayList<String>();
6    cars.add("Volvo");
7    cars.add("BMW");
8    cars.add("Ford");
9    cars.add("Mazda");
10    System.out.println(cars);
11  }
12}
13