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:
Planet.java
public class Planet { public void orbit() {/* Implementation not shown */} }
Plane.java
public class Plane { public void fly() {/* Implementation not shown */} }
Plant.java
public class Plant { public void grow() {/* Implementation not shown */} }
Main.java
import java.util.ArrayList; public class Main { public static void main(String[] args) { ArrayList<Object> objects = new ArrayList<Object>(); objects.add(new Planet()); objects.add(new Plane()); objects.add(new Plant()); for (Object o : objects) { System.out.println(o); } } }
What will this program do?
Infinite loop
Compile Error
Runtime error
Print object references to the console
Print nothing to the console