Home / Programming MCQs / JAVA MCQs / Question

P

Pradeep Sikarwar • 9.01K Points
Tutor III

Q. What will be the output of the following code

Code:
import java.util.List;

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

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

System.out.println(arrayList.size());
}

}
(A) 1
(B) 2
(C) 3
(D) 4

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.