0Pricing
Java Academy · Lesson

Design

Plan the hierarchy: choose the abstract base, list concrete shapes, pick fields and methods, and define simple polymorphic operations.

Goal & scope

Goal: Build a small shape hierarchy with an abstract base (Shape) and a couple of concrete shapes (Circle, Rectangle). We will design common operations first, then confirm the plan with tiny code prototypes.

Shapes & fields

Shapes: Circle (radius), Rectangle (width, height). Keep fields only where they belong: radius in Circle, width/height in Rectangle. The base class holds behavior contracts, not every field.

All lessons in this course

  1. Design
  2. Implementation
  3. Polymorphic Behaviors
← Back to Java Academy