Java Annotation - Built-In Annotations

Built-In Annotations

Java defines a set of annotations that are built into the language.

Annotations applied to java code:

  • @Override - Checks that the function is an override. Causes a compile warning if the function is not found in one of the parent classes.
  • @Deprecated - Marks the function as obsolete. Causes a compile warning if the function is used.
  • @SuppressWarnings - Instructs the compiler to suppress the compile time warnings specified in the annotation parameters

Annotations applied to other annotations:

  • @Retention - Specifies how the marked annotation is stored—Whether in code only, compiled into the class, or available at runtime through reflection.
  • @Documented - Marks another annotation for inclusion in the documentation.
  • @Target - Marks another annotation to restrict what kind of java elements the annotation may be applied to
  • @Inherited - Marks another annotation to be inherited to subclasses of annotated class (by default annotations are not inherited to subclasses).

Read more about this topic:  Java Annotation

Famous quotes containing the word built-in:

    PLAYING SHOULD BE FUN! In our great eagerness to teach our children we studiously look for “educational” toys, games with built-in lessons, books with a “message.” Often these “tools” are less interesting and stimulating than the child’s natural curiosity and playfulness. Play is by its very nature educational. And it should be pleasurable. When the fun goes out of play, most often so does the learning.
    Joanne E. Oppenheim (20th century)