元注解

package edu.wtbu;

import java.lang.annotation.*;

public class Demo01{

}

//Target:用于描述注解的使用范围(注解可以用在什么地方)
@Target(value = {ElementType.METHOD,ElementType.TYPE})

//Retention:(表示需要在什么级别保存该注解信息,描述注解的生命周期)表示我们的注解在那些地方有效 runtime>class>source
@Retention(value = RetentionPolicy.RUNTIME)

//Documented:表示是否将我们的注解生产在javadoc中
@Documented

//定义一个注解
@interface MyAnnotation{

}
posted @ 2023-03-24 20:31  惊鸿宴远赴人间  阅读(14)  评论(0)    收藏  举报