package Test;
public class Test {
@Deprecated
public void oldMethod () {
//過時方法示例
}
public void newMethod() {
//正常方法
}
public static void main(String[] args) {
Test test = new Test();
test.oldMethod(); //舊方法會顯示刪除線,提示方法已過時,但不影響正常使用
test.newMethod();
}
}
IDE中顯示效果: