jdk中Annotation 使用

Annotation 在java.lang包下

一、五个基本的Annotation

1.@Override 限定重写父类的方法    必须重写

2.@Deprecated 标记已过时

public class Apple extends Fruit{
	@Override
	public void info(){
		System.out.println("Apple override the fruit medthod info()");
	}
	@Deprecated
	public void inf0(){
		System.out.println("deprecated method");
	}
	public static void main(String[] args){
		new Apple().inf0();
	}
}

3.@SuppressWarnings  抑制编译器警告

4.

你可能感兴趣的:(annotation)