~/ learn/ java-from-zero/ cards/ Annotations & Reflection
1 of 16

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/6ae28a32-6ee0-4b33-b122-39df05e42226/flashcard utf-8 LF