2019独角兽企业重金招聘Python工程师标准>>>
一、概述
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
//标注本方法已过时,提示用户不要再使用!但不影响已经使用的!@Deprecatedpublic static void sayHello(){System.out.println("Hello,LH!");}
3、@Override
@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;}