數(shù)據(jù)類型
| 分類 | 類型 |
|---|---|
| 基本數(shù)據(jù)類型 | byte、char、short、int、long、double、float、boolean |
| 枚舉類型 | enum |
| 引用類型 | Object類、interface接口、array數(shù)組 |
包裝類
| 分類 | 類型 |
|---|---|
| 數(shù)值類 | Byte、Short、Integer、Long、Float、Double(Number子類) |
| 對象類 | Character、Boolean |
| 高精度計(jì)算類 | BigInteger、BigDecimal(常用于貨幣計(jì)算) |
基本數(shù)據(jù)類型與包裝類
數(shù)據(jù)類型 包裝類 內(nèi)存空間 取值范圍 byte Byte 8bit=1b -27~27-1 (-128~127) short Short 16bit=2b -215~215-1 int Integer 32bit=4b -231~231-1 long Long 64bit=8b -263~263-1 float Float 32bit=4b -- double Double 64bit=8b -- char Character 16bit=2b 0~216(65536) boolean Boolean -- true、false void Void --特殊存在 -- 字符在不同編碼中占用的字節(jié)
編碼類型 英文字符 中文字符 ISO8859-1 1b 1b GB2312 1b 2b GBK 1b 2b UNICODE 1b 2b UTF-8 1b 3b