Question from the Java - Fundamentals test

Add elements to an ArrayList in Java

Easy

Given this code :

import java.util.ArrayList;
import java.util.List;
public class ArrayListQuestion {
public static void main(String[] args)
{
   List<String> list = new ArrayList<String>();
    list.add("Dhanbad");
    list.add(0, "New York");
    list.add("Mumbai");
    list.add(2, "Sydney");
    System.out.println(list);
  }
}

What will be displayed ?

Author: PierreStatus: PublishedQuestion passed 1862 times
Edit
4
Community EvaluationsNo one has reviewed this question yet, be the first!