In 1995 when Sun Microsystems released a new programming language called Java, few thought it would take the world by storm. Not only java became a big success, it made programming languages like C and C++ a run look outdated and less secure. The Object oriented concept was well received by the programmers and developers. The complete lack of user friendliness and an absence of an IDEwhile coding and developing was Java’s biggest drawback and when the C# language was introduced; Java’s importance slowly began to decline.  In order to overcome a certain part of it Java makers included special Meta data syntaxes into the java code, this was called Java Annotations. The annotations were flexible and reflective, the addition to the class files were pretty simple and while debugging it could be retrieved easily.  Java annotations became a salient feature of the Java technology from JDK 5.0 onwards, here the main components of a programming languages annotation takes place such as methods, classes, namespaces, assemblies, variables etc.

The “@” sign is denoted first before an annotation. For e.g. @variable is written in front of a variableand then is followed by the annotation name. The main feature of an annotation is that it explains the program data which is not at all belong to the original program code.

The main uses of Java Annotations

  • Compiler gets Information
  • Create XML Files, decrease deployment time
  • Generation of Code
  • Processing the code during runtime

The three types of Annotations based on the data provided Marker, Single Element & Multi Value, In JDK5 version of Java there are simple and Meta annotation available. Simple annotations are used in the case of code data, creating a custom annotation is not supported. Override, Deprecated and Suppress Warnings are the three types of simple annotations we get with JDK5.0 while the Metaannotations, used for creating annotations on annotations are divided into 4 different types namely target, retention, documented & inherited

Download Java Annotations Tutorial.