package com.logicbig.example.clazz;
import java.lang.annotation.Annotation;
import java.util.Arrays;
public class GetAnnotationsExample {
public static void main(String... args) {
Annotation[] annotations = MyClass.class.getAnnotations();
String s = Arrays.toString(annotations);
System.out.println(s);
}
@Deprecated
@FunctionalInterface
private static interface MyClass {
void doSomething();
}
}
Output
[@java.lang.Deprecated(forRemoval=false, since=""), @java.lang.FunctionalInterface()]