昨天在看[猜数字系列]DeepGreen v1.0 深绿 GUI版时,发现用jdk1.6.0_07编译的时候会产生这样的讯息:
Note: DeepGreen.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
看来这个程式是旧了点了,所以我照着吩咐用javac -Xlint DeepGreen.java来看看是怎样的情形:
DeepGreen.java:275: warning: [deprecation] show() in java.awt.Window has been de
precated
new DeepGreen().show();
^
DeepGreen.java:11: warning: [serial] serializable class DeepGreen has no definit
ion of serialVersionUID
public class DeepGreen extends javax.swing.JFrame {
^
2 warnings
有这两个警告讯息,看来就清楚多了,就可以改了!
new DeepGreen().show();
show的方法过时要改用setVisible(true)
第二个警告只要多加public static final long serialVersionUID = 123456789L;
这样一行就可以消除警告了!
不过进去看程式时看到@author YoshiHuang这个注解,就Google,发现到sun的网站上有这样一篇文章:How to Write Doc Comments
for the Javadoc Tool,不过sun的文章有不得任意翻译的限制,所以就再Google了一下,找到JavaTwo Friday学习札记有这两篇类似的文章:
这对看如何在source写注解很有帮助!