Please enable JavaScript to use CodeHS

Want to receive Question of the Day updates? Subscribe Here

AP CSA Question of the Day March 10, 2025

Reference
  1. Incorrect Correct No Answer was selected Invalid Answer

    Given:

    Armor.java

    public class Armor {/* Implementation not shown */}
    Java

    Key.java

    public class Key {/* Implementation not shown */}
    Java

    Potion.java

    public class Potion {/* Implementation not shown */}
    Java

    Item.java

    public class Item {
    
        public Item() {}
    
    }
    Java

    Main.java

    public class Main
    {
        public static void main(String[] args)
        {
            Item armor = new Armor();
            Item key = new Key();
            Item potion = new Potion();
        }
    }
    Java

    Why does this code not compile?