Understanding code with collections

Report a typo

In this problem, we will 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(8);
numbers.add(3);

System.out.println(numbers.get(numbers.size() - 1));
Enter a number
___

Create a free account to access the full topic