我想为当前时间增加 5 秒
Date date = new Date();
date.setSeconds(date.getSeconds()+ 5);
System.out.println("old Value is: "+date);
System.out.println("New Value is: "+ date);
Run Code Online (Sandbox Code Playgroud)
它生成正确的输出正是我需要的:
Old Value is: Thu Apr 17 14:10:33 PKT 2014
New Value is: Thu Apr 17 14:10:38 PKT 2014
Run Code Online (Sandbox Code Playgroud)
但它给了我一条警告错误消息
Multiple markers at this line
- The method getSeconds() from the type Date is deprecated
- The method setSeconds(int) from the type Date is
deprecated
Run Code Online (Sandbox Code Playgroud)
这是什么意思。忽略此警告是否安全?如果不是那么如何处理呢?
| 归档时间: |
|
| 查看次数: |
15185 次 |
| 最近记录: |