JAVA內建註解 基本註解

來源:互聯網
上載者:User

標籤:import   註解   check   cti   abstract   str   turn   return   rri   

溫故而知新,可以為師矣!

每天複習,或者學習一點小東西,也能水滴石穿!

今天複習5個JAVA內建基本註解(貼代碼勝過千言萬語):

package com.lf.test;import java.util.ArrayList;import java.util.List;public class test1 extends Object {        // [email protected] (jdk1.5更新)    // Override 表示:重寫    @Override        public String toString() {        return super.toString();    }    // 2.SuppressWarnings (jdk1.5更新)    // @SuppressWarnings("rawtypes") 表示:抑制編譯器警告(這裡清除)    // rawtypes(單類型)    // @SuppressWarnings(value={"unchecked", "rawtypes"})      // {"unchecked", "rawtypes"} (多類型)    // @SuppressWarnings("all")     // all(所有)    @SuppressWarnings("all")    public static void main(String[] args) {        List user = new ArrayList();             }        // [email protected] (jdk1.5更新)    // @Deprecated 表示:某個程式元素(類、方法等)已淘汰    @Deprecated    public static void queryUser(){            }    // 4.SafeVarargs (jdk1.7更新) 表示:專門為抑制“堆汙染”警告提供的。    }//[email protected] (jdk1.8更新) 表示:用來指定某個介面必須是函數式介面,否則就會編譯出錯。// 函數式介面:Java8規定,如果介面中只有一個抽象方法(可以包含多個預設方法或多個static方法),該介面稱為函數式介面。// 如:@FunctionalInterfaceinterface function {   static void staticFun(){       System.out.println("static方法");   }   default void defaultFun(){       System.out.println("預設方法");   }      void abstractFun();//只定義了一個抽象方法,如再定義一個抽象方法,則會報錯}

 

如有錯誤,歡迎留言指正!

JAVA內建註解 基本註解

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.