A

Admin • 828.03K Points
Coach

Q. What will be the output of the following code

Code:
import java.util.ArrayList;
import java.util.List;

public class ArrayListTest {
public static void main(String args[])
{
List<String> arrayList=new ArrayList<String>();

arrayList.add(“a”);
arrayList.add(“b”);
arrayList.add(“c”);

System.out.println();
arrayList.add(1,”d”);
System.out.println(arrayList);
}

}
  • (A) [a, d, b, c]
  • (B) [a, b, c, d]
  • (C) [d, a, d, c]
  • (D) None
  • Correct Answer - Option(A)
  • Views: 10
  • Filed under category Java
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.