Java annotations provide metadata for Java code and are used for compiler instructions, build-time instructions, and runtime instructions. The main types of annotations are built-in annotations like @Override, @Deprecated, and @SuppressWarnings which provide instructions to the compiler. Custom annotations can also be created using the @interface keyword and can be applied to classes, methods, and fields. Annotations specify metadata through annotation elements.