8.11 过期声明. @Deprecated 代码升级过度用

  • @Deprecated 代码升级过度用;
class Channel {
    @Deprecated // 老系统继续用,新系统不要用了---编译会有提示,但执行成功;
    public void connect(){
        System.out.println("***** Channel ******");
    }

    public String connection(){
        return "获取了xxx通道信息.";
    }
}



public class HelloWorld {
    public static void main(String args[]){
        new Channel().connect();// 会有提示,但编译成功
    }
}
posted @ 2023-06-07 18:01  盘思动  阅读(12)  评论(0编辑  收藏  举报