Annotations   «Prev  Next»

Built-in Annotations

The following table lists Java's built-in annotations which are in the java.lang package. Take a bit of time to study and memorize this table.
You may be tested on the retention policy and target of these on the exam.

Deprecated

Override

Built-in Annotations 1

Built-in Annotations 2

@SuppressWarnings is a pre-defined Java Annotation.
interface Functionable {
    void performSomeFunction();
}

The interface consists of a single abstract method. An interface is not a functional interface if it has more than 1 abstract method.
You cannot use this Annotation @FunctionalInterface in front of an abstract class because it is not an interface.
Cannot apply @FunctionalInterface to an 1) abstract class or 2) enum.
If a type is annotated with this annotation type, compilers are required to generate an error message unless:
  1. The type is an interface type and is not an annotation type, enum or class,
  2. The annotated type satisfies the requirements of a functional interface.