JAVA的数据类型

      所有Java 虚拟机中使用的数据都有确定的数据类型,数据类型和操作都在Java 虚拟机规范中严格定义。Java 中的数据类型分为原始数据类型 (primitive types )和引用数据类型(reference type )。引用类型依赖于实际的对象,但不是对象本身。原始数据类型不依赖于任何东西,它们就是本身表示的数据。
  
所有Java 程序语言中的原始数据类型,都是Java 虚拟机的原始数据类型,除了布尔型(boolean 。当编译器将Java 源代码编译为字节码时,使 用整型(int )或者字节型 (byte )去表示布尔型。在Java 虚拟机中使用整数0 表示布尔型的false ,使用非零整数表示布尔型的true ,布尔数组被表示为字节数组,虽然它 们可能会以字节数组或者字节块(bit fields )保存在堆中。
    
除了布尔型,其它的原始类型都是Java 虚拟机中的数据类型。在Java 中数据类型被分为:整形的byteshortintlongchar 和浮点型的floatdoubleJava 语言中的数据类型在任何主机上都有同样的范围
 
    
Java 虚拟机中还存在一个Java 语言中不能使用的原始数据类型---- 返回值类型(return value 。这种类型被用来实现Java 程序中的“finally classes” ,具体的参见18 章的“Finally Classes”
    
引用类型可能被创建为:类类型(class type ),接口类型(interface type ),数组类型(array type )。他们都引用被动态创建的对象。当引用类型引用null 时,说明没有引用任何对象。
     Java
虚拟机规范只定义了每一种数据类型表示的范围,没有定义在存储 时每种类型占用的空间。他们如何存储 Java 虚拟机的实现者自己决定

     <!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"/@宋体"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:宋体; mso-font-kerning:1.0pt;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} -->

TypeRange

byte8-bit signed two's complement integer (-27 to 27 - 1, inclusive)
short16-bit signed two's complement integer (-215 to 215 - 1, inclusive)
int32-bit signed two's complement integer (-231 to 231 - 1, inclusive)
long64-bit signed two's complement integer (-263 to 263 - 1, inclusive)
char16-bit unsigned Unicode character (0 to 216 - 1, inclusive)
float32-bit IEEE 754 single-precision float
double64-bit IEEE 754 double-precision float
returnValueaddress of an opcode within the same method
referencereference to an object on the heap, or null

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值