Annotations in Java
Annotations are a way to add metadata to your code. They can be used to provide information about the code, such as the author or version number, or to configure how the code is compiled or run.
Example code:
less
@Author(name = "Alice", email = "alice@example.com")
public class MyClass {
// code here
}
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Author {
String name();
String email();
}
No comments:
Post a Comment