1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時(shí)間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
      Java中boolean占幾字節(jié)-創(chuàng)新互聯(lián)

      這篇文章主要介紹“Java中boolean占幾字節(jié)”,在日常操作中,相信很多人在Java中boolean占幾字節(jié)問題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”Java中boolean占幾字節(jié)”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!

      創(chuàng)新互聯(lián)主營(yíng)江孜網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營(yíng)網(wǎng)站建設(shè)方案,重慶APP開發(fā)公司,江孜h5微信小程序搭建,江孜網(wǎng)站營(yíng)銷推廣歡迎江孜等地區(qū)企業(yè)咨詢

      這是一個(gè)看似簡(jiǎn)單,實(shí)則深究能發(fā)現(xiàn)其中一二玄機(jī)的問題

      讓我們來(lái)看一下官方文檔中的說(shuō)法

      "boolean: The boolean data type has only two possible values: true and false. Use this data type for simple flags that track true/false conditions. This data type represents one bit of information, but its "size" isn't something that's precisely defined."

      上面說(shuō)的很清楚,boolean值只有true和false兩種,這個(gè)數(shù)據(jù)類型只代表1bit的信息,但是它到底占了多少空間,卻沒有嚴(yán)格的說(shuō)法,也就是說(shuō),不論它的所占空間是多少,只有1bit的信息是有意義的


      "In Oracle’s Java Virtual Machine implementation, boolean arrays in the Java programming language are encoded as Java Virtual Machine byte arrays, using 8 bits per boolean element."

      在 Oracle 的 Java 虛擬機(jī)實(shí)現(xiàn)中,Java 語(yǔ)言中的 boolean 數(shù)組被編碼成 Java 虛擬機(jī)的 byte 數(shù)組,每個(gè)元素占 8 比特。

      "The Java Virtual Machine does directly support boolean arrays. Its newarray instruction (§newarray) enables creation of boolean arrays. Arrays of type boolean are accessed and modified using the byte array instructions baload and bastore (§baload, §bastore)."

      Java 虛擬機(jī)中雖然定義了 boolean 類型,但是支持是很有限的,沒有專門的虛擬機(jī)指令。

      同時(shí)在 Java 語(yǔ)言中,對(duì) boolean 值的操作被替換成 int 數(shù)據(jù)類型。

      再去看看 Java 虛擬機(jī)規(guī)范上是怎么寫的。

      "Although the Java Virtual Machine defines a boolean type, it only provides very limited support for it. There are no Java Virtual Machine instructions solely dedicated to operations on boolean values. 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."

      “The Java Virtual Machine encodes boolean array components using 1 to represent true and 0 to represent false . 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 虛擬機(jī)使用 1 表示 true ,0 表示 false 來(lái)編碼 boolean 數(shù)組。

      Java 語(yǔ)言的 boolean 值被編譯器映射成 Java 虛擬機(jī)的 int 類型的時(shí)候,也是一樣的

      到這里,得出一個(gè)結(jié)論:

      boolean到底占幾個(gè)字節(jié),依賴于JVM

      第一,無(wú)論Boolean占用多少字節(jié),只有1bit的值是有意義的

      第二,boolean 類型被編譯成 int 類型來(lái)使用,占 4 個(gè) byte 。

      第三,在 Java 虛擬機(jī)里,1 表示 true ,0 表示 false 。

      到此,關(guān)于“Java中boolean占幾字節(jié)”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!


      文章標(biāo)題:Java中boolean占幾字節(jié)-創(chuàng)新互聯(lián)
      分享路徑:http://www.ef60e0e.cn/article/copgcd.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        永靖县| 滦平县| 河东区| 肇源县| 龙海市| 长丰县| 翁牛特旗| 潮州市| 策勒县| 延长县| 东阿县| 宁海县| 崇礼县| 吕梁市| 丰镇市| 筠连县| 章丘市| 江陵县| 天峻县| 吉林省| 湖州市| 余庆县| 永靖县| 南部县| 喜德县| 昔阳县| 固阳县| 土默特左旗| 石阡县| 平潭县| 淮北市| 潮安县| 睢宁县| 宁乡县| 当雄县| 育儿| 舒兰市| 盖州市| 博白县| 收藏| 稷山县|