Java-基本类型 boolean

1:存储空间java虚拟机规范中没有明确的指出,网上找的的答案是说根据虚拟机的实现有关,以下是网上找的的虚拟机规范的一部分。原文,以下是有关boolean 的虚拟机规范一部分。C/C++中bool true 为1 false为0

Instead, expressions in the Java programming language that operate on boolean values are compiled to use values of the Java virtual machine int data type.

Where Java programming language boolean values are mapped by compilers to values of Java virtual machine type int, the compilers must use the same encoding. 而:Java virtual machine type int, whose values are 32-bit signed two's-complement integers。

Arrays of type boolean are accessed and modified using the byte array instructions

In Sun's JDK releases 1.0 and 1.1, and the Java 2 SDK, Standard Edition, v1.2,boolean arrays in the Java programming language are encoded as Java virtual machine byte arrays, using 8 bits per boolean element

2:她的值只有两种true和false,和C/C++ 的(非零即是真)不同。

3:初始化默认值false

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 10,150评论 0 23
  • 我爱你 带着春风和细雨 带着黎明和黑夜 带着憧憬和奢望 带着不安和忐忑 我等你 从春风...
    不二菇凉阅读 168评论 0 0
  • 2.1 新功能: 1、邂逅功能强势回归,有缘千里来相会 2、回复即聊天,又可以和小伙伴愉快的交流了 3、消息推送,...
    QA恋阅读 326评论 0 1
  • Dosen原创 这是我学习quartz composer,Origami,看官方文档翻译下来的,每天一篇,有不准确...
    Dosen阅读 208评论 0 0
  • 妻儿琴声 2016-09-03 我在平仄细咂, 妻儿琴声啁哳。 虽无郎朗手段, 音由钢弦实发。
    四季闻蝉阅读 106评论 0 0