~/ learn/ comp-308/ cards/ Polymorphism & dynamic method binding
1 of 5

Override a method with the @Override annotation

Override a method with the @Override annotation

Answer

class Circle extends Shape { @Override void draw() { System.out.println("Circle"); } }

Same signature as `Shape.draw()`. `@Override` makes the compiler verify it truly overrides — catching typos that would otherwise create a silent new method.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/f18ed4fa-9592-4f37-9968-d0069ddd3033/flashcard utf-8 LF