认识注解

自定义注解

注解的原理

元注解

常用的两个元注解

代码:
MyTest1(注解类)
package com.itheima.day10_annotation;import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;@Target({ElementType.TYPE,ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface MyTest1 {
}
AnnotationTest1(主程序,认识元注解,搞清楚元注解的作用)
package com.itheima.day10_annotation;
@MyTest1
public class AnnotationTest1 {@MyTest1public void test1(){}
}