Annotations

Objectives

  • Discuss the purpose and use of Java annotations
  • Use Java annotations

Common annotations

  • Specify that a method is an override (placed just before method definition): @Override
  • Specify the author of source code (in comments): @Author(name = "Ebenezer Farquar")
  • Suppress compiler warnings from showing up during compile (placed just before method definition): @SuppressWarnings(value = "unchecked")
  • Simpler versions of previous item (because there is only one value parameter):
    • @SuppressWarnings("unchecked")
    • @SuppressWarnings("deprecation")

Links to resources for class