返回顶端

Java 注解与反射(一)内置注解

Java 注解与反射(一)内置注解

public class Demo01 implements Runnable{

    //三个内置注解    Override Deprecated SuppressWarnings
    @Override   //重写
    public void run() {

    }

    @Deprecated //过时的 不推荐使用或存在更好的处理方法 仍可使用
    public static void testMethod(){
        System.out.println("过时的方法");
    }

    @SuppressWarnings("all")    //镇压警告
    public  void TestMethod2(){
        int a;  //a未被使用而没有被警告
    }

    public static void main(String[] args) {
        testMethod();
    }
}

posted @ 2021-04-03 16:11  EEEEEEEric  阅读(46)  评论(0)    收藏  举报