package 注解;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
public class 自定义注解 {
@MyAnnotation1(value = "哈哈哈",name="哈哈哈")
public void test(){
}
}
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@interface MyAnnotation1{
//设置默认参数,默认为value
String value();
//设置name参数
String name();
//设置参数默认值,默认为0
int age() default 0;
}
javaSE注解和反射之自定义注解
猜你喜欢
转载自blog.csdn.net/qq_42794826/article/details/109033129
今日推荐
周排行