答案:否。
可以 自己写一个 注解类测试一下,如下:
package test;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface testAn {
public int alert();
public int test(int a);
}
编译报错如下:
Annotation attributes cannot have parameters
译为:注解属性不能包含参数。