码迷,mamicode.com
首页 > 编程语言 > 详细

java 基本类型(primitive type)

时间:2017-04-13 15:08:50      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:取值   padding   ble   示例   har   pad   mit   基本类型   指定   

类型 默认值 取值范围 示例
byte(Byte) 0 -2^7----2^7-1 byte b=10;
char(Character) ‘ \u0000‘ 0----2^16-1 char c=‘c‘;
short(Short) 0 -2^15----2^15-1 short s=10;
int(Integer) 0 -2^31----2^31-1 int i=10;
long(Long) 0 -2^63----2^63-1 long o=10L;
float(Float) 0.0f -2^31----2^31-1 float f=10.0F
double(Double) 0.0d -2^63----2^63-1 double d=10.0;
boolean(Boolean) false true\false boolean flag=true;
 
在基本类型中,如果不明确指定,整数型的默认是int,带小数的默认是double。

java 基本类型(primitive type)

标签:取值   padding   ble   示例   har   pad   mit   基本类型   指定   

原文地址:http://www.cnblogs.com/luotianle/p/6703969.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!