Get an element

Report a typo

In this problem, let's check your intuition about the work of collections.

What does the following code print?

ArrayList<Integer> numbers = new ArrayList<>();
numbers.add(5);
numbers.add(4);
numbers.add(3);
numbers.add(8);
numbers.add(1);

System.out.println(numbers.get(3));
Enter a number
___

Create a free account to access the full topic