Java 注解和反射的示例代码
一、注解 1. 初识注解 package com.onlineframework; import java.util.ArrayList; import java.util.List; @SuppressWarnings("all") public class annoTest { @Override public String toString() { return super.toString(); } @Deprecated public static void dep(){ System.out.println("dep"); } public static void test02(){ List list = new ArrayList(); } public static void main(String[] args) { dep(); test02(); } } 2. 元注解 package com.onlineframework; import java.lang.annotation.*; @MyAnnotation public class AnnoTest02 { @MyAnnotation public void test(){ } } @Retention(RetentionPolicy.SOURCE) @Target({ElementType.METHOD,ElementType.TYPE}) @Documented @Inherited @interface MyAnnotation{ //@interface自动继承了java....