Skip to main content

Unit 4 · Data Collections

ArrayList and Wrapper Classes

ArrayList and Wrapper Classes MCQ Practice

Question 1 of 15

Answered 0 of 15

Choose one answer.

What is printed by the following code segment?

public class ArrayListAndWrapperClassesContext
{
    public static void runExample()
    {
        ArrayList<Integer> a = new ArrayList<Integer>();
        a.add(5);
        int x = a.get(0);
        System.out.print(x + 1);
    }

    public static void main(String[] args)
    {
        runExample();
    }
}
Choose one answer.