~/ 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/8fa37489-d406-4464-b339-c068afe9014a/flashcard utf-8 LF