筆記(4/11-4/12) java基礎

來源:互聯網
上載者:User

Navicat串連oracle報Cannot load OCI dll,126

缺少dll檔案,工具->選項->oci->oci library


非靜態方法和變數必須依附對象執行個體存在,無法直接通過類名去訪問,靜態方法和靜態方法可以


Runtime.getRuntime().availableProcessors() jvm可以使用的cpu數量

Runtime.getRuntime().freeMemory() jvm中的空閑記憶體

Runtime.getRuntime().totalMemory() jvm中的總記憶體(試圖使用的最大值)

JVM記憶體相關單位為位元組(Byte)


File.listRoots()擷取機器上各磁碟

file.getFreeSpace 擷取空閑空間 單位Byte(位元組)

file.getTotalSpace 擷取總空間  單位Byte(位元組)


SimpleDateFormat 日期格式化 DecimalFormat 數字格式化


eclipse 調格式化寬距離 preferences->Java->Code Style->Formatter->New


public enum MinaClass {
    applyAgent("xxx"),
    scriptEntry("xxx"),
    scriptExecute("xxx");


    private String className;


    MinaClass(String className){
        this.className = className;
    }


    public String getClassName() {
        return className;
    }


    public void setClassName(String className) {
        this.className = className;
    }
    
    public static void main(String args[]){
    MinaClass xClass=MinaClass.applyAgent;
    int x=1;
    }


}




    applyAgent("xxx"),
    scriptEntry("xxx"),
    scriptExecute("xxx");
這三段代碼,就是相當於先初始化了三個構造方法,可以通過類名.xx來直接產生該枚舉類,而且因為構造方法是沒有設定修飾許可權
預設許可權為private,相當於只給外部提供了這三種產生該類的方法


類如果不寫存取修飾詞是friendly (只有本類和同一包中的類可以訪問,其他沒有存取權限)
而方法不寫存取修飾詞是private (只能在本類使用,其他都不行)


switch ('1') {        case '1':        case '2':        case '3':          System.out.println("1");          break;}

相當於只要滿足'1','2','3'都輸出1;

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.