9.4

Polymorphism

AP Computer Science A

The core idea

Compile-time vs. runtime types

Example

Polymorphism with arrays and ArrayLists

With ArrayList

How Java resolves method calls

Polymorphism with method parameters

The `instanceof` operator

Casting

Safe casting with `instanceof`

Trace: Polymorphism in action

Polymorphism does NOT apply to fields

Complete example: Payment system

AP Exam Tips

Common Mistakes

Key Vocabulary