JAVA基礎(一)

來源:互聯網
上載者:User

標籤:java 基礎

一、bit、位元組

    1 bit     =  一個位元據0或1

    1 byte(位元組)  = 8  bit  

    1 字母 = 1  byte = 8 bit  

    1 漢字 = 2  byte = 16 bit  


二、基礎資料類型及封裝類

基本類型 大小(位元組) 預設值 封裝類
byte 1 (byte)0 Byte
short 2 (short)0 Short
int 4 0 Integer
long 8 0L Long
float 4 0.0f Float
double 8 0.0d Double
boolean - false Boolean
char 2 \u0000(null) Character
void - - Void














基礎資料型別 (Elementary Data Type)只能按值傳遞,而封裝類按引用傳遞。

基本類型在堆棧中建立;而對於物件類型,對象在堆中建立,對象的引用在堆棧中建立。基本類型由於在堆棧中,效率會比較高,但是可能會存在記憶體流失的問題


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.