Java Annotation Types: Simple Annotation

There are two types of annotations available with JDK5:

  • Simple annotations: These are the basic types supplied with Tiger, which you can use to annotate your code only; you cannot use those to create a custom annotation type.
  • Meta annotations: These are the annotation types designed for annotating annotation-type declarations. Simply speaking, these are called the annotations-of-annotations.

 

Simple Annotation

  • Override
  • Deprecated
  • Suppresswarnings

Override

 

 

Deprecated

 

After warning also output will be produced.

 

Suppresswarnings

For fixing above “deprecated” warning compiler will provide quick fix for it too. So if Supresswarning is been applied then compiler will not show any warning, if at all “deprecate’ warning will be flagged. But big YES, other warnings will definitely will be raised by compiler.

 

deprecated annotation

 

 

 

@Annotations

  1. Annotations and Its Benefits in Java
  2. Advantages Of Annotations Over XML
  3. Annotation Programming Basics
  4. Annotation Types
    1. Simple Annotation
    2. Meta Annotation
      1. Meta ‘Target’ Annotation
      2. Meta ‘Retention’ Annotation
      3. Meta ‘Documented’ Annotation
      4. Meta ‘Inherited’ Annotation
  5. Reflection to Extract Annotation Details

Leave a Reply

Your email address will not be published. Required fields are marked *