Java 資料型別相關

2021-07-03 01:04:46 字數 369 閱讀 2448

相關的點:

1.自動型別轉換  char byte short 之間做轉換是 int型別

2.強制型別轉換導致精度損失 -  大專小     -   

3.字串也相關基礎型別  + 是連線運算子   的得到的結果是字串

string l1="hello"; int i1=12; char ch1='a'; //a:97

system.out.println(l1+i1+ch1);  //hello12a

system.out.println(i1+ch1+l1); //109hello

system.out.println(ch1+l1+i1);//a12hello

資料型別相關

整型常量 十進位制 18 31 long int型常量 123l 123l 123456l 123456l unsigned int型常量 123u 123u 根據實際資料大小確定int型還是long型 l以數字 0 開始的整型常量是八進位制數 022 037 010和10大小不一樣 因為八進位制並...

java資料型別

整型 型別 儲存大小 取值範圍 int4位元組 2 147 483 648 2 147 483 647 21億 short 2位元組 32 768 32 767 long 8位元組 9 223 372 036 854 775 808 9 223 372 036 854 775 808 byte 1位...

java資料型別

1.整型 int 4位元組 byte 1位元組 short 2位元組 long 8位元組 2.浮點型 float 4位元組 double 8位元組 3.邏輯性 boolean false true 4.字元型 char 2位元組 c語言中時1位元組 類 介面 陣列 在棧中可以直接分配記憶體的資料就是...