p3元注解
import java.lang.annotation.*;
@MyAnnotation
public class Test02 {
public void test(){
}
}
//定义一个注解
//Target 表示我们的注解可以用在那些地方
@Target(value = {ElementType.METHOD, ElementType.TYPE})
//Retention 表示我们的注解在什么地方还有效
// runtime>class>sources
@Retention(value = RetentionPolicy.RUNTIME) //在运行时有效
//Documented 表示是否将我们的注解生成
@Documented
@interface MyAnnotation{
}