Please enable JavaScript to use CodeHS

Want to receive Question of the Day updates? Subscribe Here

AP CSA Question of the Day Jan. 20, 2025

Reference
  1. Incorrect Correct No Answer was selected Invalid Answer

    What value will be printed in the console after this series of commands? Assume that the ArrayList package has been imported.

    ArrayList<Integer> array = new ArrayList<Integer>();
    array.add(5);
    array.add(4);
    array.add(3);
    array.add(2);
    array.add(1);
    array.remove(1);
    array.set(0, 2);
    int num = array.get(1);
    System.out.println(num);
    Java