~/ 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/6b691496-30e0-414d-84d2-d9356b283af9/flashcard utf-8 LF