
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are Annotations in Java
Annotations are a tag (metadata) which provides info about a program.
- Annotations in Java Start with the symbol ?@'.
- They are used by the compiler to detect errors.
- Software tools to generate code.
- They are used to show attributes of an element: e.g. @Deprecated, @Override.
- Annotation are used to describe the purpose of an element of the framework, e.g. @Entity, @TestCase, @WebService
- Annotations describe the behaviour of an element: @Statefull, @Transaction.
Example
class Sample{ public void display(){ System.out.println(" "); } } public class Test extends Sample { @Override public void display(){ System.out.println("Welcome to Tutorialspoint"); } public static void main(String[] args) { Test obj = new Test(); obj.display(); } }
Output
Welcome to Tutorialspoint
Advertisements