~/ learn/ java-from-zero/ cards/ Built-in annotations: @Override, @Deprecated, @SuppressWarnings and friends
1 of 4

Type @Override on a toString override

Type @Override on a toString override

Answer

@Override public String toString() { return "MyList"; }

@Override tells the compiler "this must override a method in the parent class or an implemented interface." If it does not — due to a typo or wrong signature — the code fails to compile.

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/e17f6566-5fd0-4dc0-a6b0-8b23459362fb/flashcard utf-8 LF