Explore what CodeHS has to offer for districts, schools, and teachers.
Click on one of our programs below to get started coding in the sandbox!
View All
Given the following classes:
public class Pie { /* Implementation not shown */ } public class Pumpkin extends Pie { /* Implementation not shown */ }
Which of the following objects can be added to the following ArrayList? ArrayList<Pumpkin> pies = new ArrayList<Pumpkin>();
ArrayList<Pumpkin> pies = new ArrayList<Pumpkin>();
Pumpkin p = new Pie();
Pumpkin p = new Pumpkin();
Pie p = new Pumpkin();
1 Only
2 Only
1 and 2 Only
2 and 3 Only
1, 2, and 3