Please enable JavaScript to use CodeHS

Want to receive Question of the Day updates? Subscribe Here

AP CSA Question of the Day March 18, 2025

Reference
  1. Incorrect Correct No Answer was selected Invalid Answer

    Given the following classes:

    public class Pie
    {
        /* Implementation not shown */
    }
    
    public class Pumpkin extends Pie
    {
        /* Implementation not shown */
    }
    Java

    Which of the following objects can be added to the following ArrayList?
    ArrayList<Pumpkin> pies = new ArrayList<Pumpkin>();

    1. Pumpkin p = new Pie();
    2. Pumpkin p = new Pumpkin();
    3. Pie p = new Pumpkin();