Java › Annotations
What do the built-in @Override, @Deprecated, and @SuppressWarnings annotations do?
BeginnerAnswer
@Override tells the compiler a method is intended to override a superclass/interface method, causing a compile error if no matching method actually exists (catching typos like a mismatched method signature); @Deprecated marks an element as discouraged for use, triggering a compiler warning at call sites and signaling to other developers (and tools) that it may be removed in the future; @SuppressWarnings suppresses specific compiler warnings (like "unchecked") for the annotated element, useful when a warning is a known, deliberately accepted trade-off.
public class Base {
public void process() { }
}
public class Derived extends Base {
@Override
public void proccess() { } // typo! Compiler catches this because @Override expects an actual override
}Real-world example A refactor accidentally misspells an overridden method name, but because the method was marked @Override, the compiler immediately flags the error at build time rather than silently creating an unrelated new method that would have caused a confusing runtime bug.