1.作用是解释注解
4.提供4种,在java.lang.annotation,
@Target,指明用在什么地方
@Retention,描述注解生命周期
@Document,文档
@Inherited,继承
====================
package com.wuming.annotation;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 表示注解是否生成在JAVAdoc中 //Inherited 子类可以继承父类的注解 @Inherited @interface MyAnnotation{}