Unit 4 · Data Collections
ArrayList Basics
ArrayList Basics MCQ Practice
Question 1 of 15
Answered 0 of 15
Choose one answer.
What is printed by the following code segment?
public class ArrayListBasicsContext
{
public static void runExample()
{
ArrayList<Integer> a = new ArrayList<Integer>();
a.add(5);
a.add(9);
System.out.print(a.size() + " " + a.get(0));
}
public static void main(String[] args)
{
runExample();
}
}