java學習之第三周總結

來源:互聯網
上載者:User

做完第三周題目後,感覺好多東西不知道,總結一下,有如下內容:

1.static與public順序無所謂,只是習慣而已;

2.構造方法可以聲明為private,但只能在本類中建立對象;

3..當一個對象被當作參數傳入到一個方法中,方法內部改變該對象的屬性值,也是值傳遞;

4.數組的length是屬性,String有length()方法;

5.String str = new String(“hello”);這句代碼之前沒有建立“hello”字串對象,則這句代碼建立了2個對象,一個是new String(),一個是“hello”。

6.char x = ‘b’;
   int i = 0;
   System.out.println(true?x:0);     
   System.out.println(true?x:1111111110); 
   System.out.println(false?i:x); 

   第一個輸出b,後面數字在char的範圍0-65535內,x不自轉;範圍之外,x自轉;若是比char精度高的變數,自轉。

聯繫我們

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