首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

JAVA中8种基本数据类型的默认值

2012-10-29 
JAVA中八种基本数据类型的默认值引用For type byte, the default value is zero, that is, the value of (

JAVA中八种基本数据类型的默认值
引用For type byte, the default value is zero, that is, the value of (byte)0.
For type short, the default value is zero, that is, the value of (short)0.
For type int, the default value is zero, that is, 0.
For type long, the default value is zero, that is, 0L.
For type float, the default value is positive zero, that is, 0.0f.
For type double, the default value is positive zero, that is, 0.0d.
For type char, the default value is the null character, that is, '\u0000'.
For type boolean, the default value is false.
以上摘自《Java Language Specification Second Edition》CHAPTER 4

   基本类型       默认值     byte0short0int0long0Lfloat0.0fdouble0.0dchar'\u0000'booleanfalse

热点排行