一、概述
jdk的java.lang包中提供的最基本的annotation
1、@SuppressWarnings("deprecation")
package staticimport.annotation;@SuppressWarnings("deprecation")public class AnnotationTest { public static void main(String[] args) { System.runFinalizersOnExit(true); AnnotationTest.sayHello(); }}
2、
//标注本方法已过时,提示用户不要再使用!但不影响已经使用的! @Deprecated public static void sayHello(){ System.out.println("Hello,LH!"); }
3、
@Override//该注解一般为避免类似ReflectPoint参数类型错误 public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ReflectPoint other = (ReflectPoint) obj; if (x != other.x) return false; if (y != other.y) return false; return true; }