Java: Annotations tutorial with examples
Repost from: https://beginnersbook.com/2014/09/java-annotations/ Java Annotations allow us to add metadata information into our source code, although they are not a part of the program itself. Annotations were added to the java from JDK 5. Annotation has no direct effect on the operation of the code they annotate (i.e. it does not affect the execution of the program). In this tutorial we are going to cover following topics: Usage of annotations, how to apply annotations, what predefined annotation types are available in the Java and how to create custom annotations. What’s the use of Annotations? 1) Instructions to the compiler : There are three built-in annotations available in Java ( @Deprecated , @Override & @SuppressWarnings ) that can be used for giving certain instructions to the compiler. For example the @override annotation is used for instructing compiler that the annotated method is overriding the method. More about these built-in ann...