Practice · 2 of 3
Abstract shapes with conditional overrides
CHALLENGE
Difficulty: advanced+25 XP
Implement Shape (abstract): public abstract int area(); plus a concrete describe() returning "shape:" + area(). Subclass Square (side; area = side*side) and Rect (w, h; area = w*h). Then implement totalArea(ArrayList<Shape>).
The list may contain both; use the abstract reference type.
Press Submit to check your solution.
Back to lesson: Practice: Polymorphism gauntlet