1、以下代码的运行结果(1)Perform.javaimport java.lang.annotation.*;@Retention(RetentionPolicy.RUNTIME)@Documentedpublic @interface Perform{}(2)Test.javaimport java.lang.annotation.*;import java.lang.reflect.Method;public class Test {@Performpublic void testMethod() {}@Performpublic void test() {}public static void main(String[] args) throws Exception {Method testMethod = Test.class.getDeclaredMethod("testMethod");System.out.println(testMethod);Annotation[] ans = testMethod.getDeclaredAnnotations();if( testMethod != null ) {System.out.println(ans.length);}else {System.out.println("无注解");}}}
A. 程序报错
B. 无注解
C. 2
D. 1