Search This Blog

Saturday, June 14, 2025

Java History - Annotations

 Java annotations are a form of metadata that provides additional or supplemental data to a Java source file. An annotation provides information to the Java compiler and JVM. 

An annotation starts with the @ symbol and does not change the action of a program. Annotations can be applied to classes, constructors, methods, instance variables, and so on. 

A program can use predefined annotations like @deprecated, or a programmer can create their own annotations depending on the requirement.

@interface TestAnnotation {

   String myStr();

}

In which version of Java were annotations introduced?

a) Java 11

b) Java 17

c) Java 8

d) Java 5

e) Java 6


Created by Nancy K A N

@14:47 14-Jun-2025



No comments:

Post a Comment