package com.annotation;
import java.util.Date;
import java.util.Map;
import java.util.TreeMap;
public class SuppressWarningTest
{
/**
* SuppressWarnings: 抑制警告, 参数是数组, 可以是一个元素也可以是多个, 多个则用{}括起来
*
* 1.unchecked: 不检查
*
* 2.deprcation: 抑制不建议使用的方法的警告
*
*/
@SuppressWarnings(value = {"unchecked", "deprecation"})
public static void main(String[] args)
{
Map map = new TreeMap();
map.put("Zs","张三");
System.out.println(map);
Date date = new Date();
System.out.println(date.toLocaleString()); // 不建议被使用的, 使用"deprecation" 让警告消失
}
}