数据类型
| 基本数据类型 | 数值型 | 整型byte/short/int/long | |
| 浮点型/double/float | |||
| 字符型char | |||
| 布尔型boolean | 取值true false | ||
| 对象数据类型 | 类Class | ||
| 接口 interface | |||
| 数组array[] |
| 类型 | 对象 | 位数 | 字节数 | 最小值 | 最大值 |
|
byte |
Byte | 8 | 1 | -128=2^7 | 127=2^7-1 |
|
short |
Short | 16 | 2 | -32768=2^15 | 32767=2^15-1 |
|
int |
Integer | 32 | 4 | -2147483648=2^31 | 2147483647=2^31-1 |
|
long |
Long | 64 | 8 | -9223372036854775808=2^63 | 9223372036854775807=2^63-1 |
|
float |
Float | 32 | 4 | 2^-149 | (2-2^-23)^127 |
|
double |
Double | 64 | 8 | 2^-1074 | (2-2^-52)^1023 |
|
char |
Character |
字符型:
字符编码 ASCII (American Standard Code Information Interchage)
Unicode (统一码 java所采用的编码)
数据也有对象
int类型的对象 Integer
方法主要有:toString() 转换为String类型;
valueof()字符型转换为int型
还有Float Double 等对象。
java中的常量
前加上 final 而且定义后只能赋一次值
java学习笔记(二)之数据部分,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/xfile/p/3739225.html