久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='J43Ap'><style id='J43Ap'><dir id='J43Ap'><q id='J43Ap'></q></dir></style></legend>

      • <bdo id='J43Ap'></bdo><ul id='J43Ap'></ul>

      <small id='J43Ap'></small><noframes id='J43Ap'>

      1. <tfoot id='J43Ap'></tfoot>
      2. <i id='J43Ap'><tr id='J43Ap'><dt id='J43Ap'><q id='J43Ap'><span id='J43Ap'><b id='J43Ap'><form id='J43Ap'><ins id='J43Ap'></ins><ul id='J43Ap'></ul><sub id='J43Ap'></sub></form><legend id='J43Ap'></legend><bdo id='J43Ap'><pre id='J43Ap'><center id='J43Ap'></center></pre></bdo></b><th id='J43Ap'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='J43Ap'><tfoot id='J43Ap'></tfoot><dl id='J43Ap'><fieldset id='J43Ap'></fieldset></dl></div>

        由于java語言規(guī)則或jvm,添加字節(jié)轉(zhuǎn)換為int?

        Is addition of byte converts to int because of java language rules or because of jvm?(由于java語言規(guī)則或jvm,添加字節(jié)轉(zhuǎn)換為int?)
        <i id='rlRGL'><tr id='rlRGL'><dt id='rlRGL'><q id='rlRGL'><span id='rlRGL'><b id='rlRGL'><form id='rlRGL'><ins id='rlRGL'></ins><ul id='rlRGL'></ul><sub id='rlRGL'></sub></form><legend id='rlRGL'></legend><bdo id='rlRGL'><pre id='rlRGL'><center id='rlRGL'></center></pre></bdo></b><th id='rlRGL'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='rlRGL'><tfoot id='rlRGL'></tfoot><dl id='rlRGL'><fieldset id='rlRGL'></fieldset></dl></div>

          <bdo id='rlRGL'></bdo><ul id='rlRGL'></ul>

                <tbody id='rlRGL'></tbody>

              <small id='rlRGL'></small><noframes id='rlRGL'>

              <legend id='rlRGL'><style id='rlRGL'><dir id='rlRGL'><q id='rlRGL'></q></dir></style></legend><tfoot id='rlRGL'></tfoot>
                  本文介紹了由于java語言規(guī)則或jvm,添加字節(jié)轉(zhuǎn)換為int?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  byte a = 1;
                  byte b = 1;
                  byte c = a + b;
                  

                  拋出錯誤:可能損失精度

                  Throws error: possible loss of precision

                  byte subt = a_s - a_b;
                                  ^
                    required: byte
                    found:    int
                  

                  這種行為是否與 jvm 有關(guān)或它是用 java 語言定義的.

                  Is this behavior has something to do with jvm or its been defined in java language .

                  如果它是用 java 語言定義的,那么是因為要記住 jvm 嗎?

                  EDIT : And if it is defined in java language then does it because of keeping jvm in mind ?

                  意味著,如果Java支持的字節(jié)數(shù)據(jù)類型,那么為什么<代碼>上字節(jié)操作結(jié)果<代碼> INT

                  Means if java supports byte datatype then why operation on byte results int

                  推薦答案

                  如果java支持字節(jié)數(shù)據(jù)類型,那么為什么對字節(jié)的操作結(jié)果是int

                  if java supports byte datatype then why operation on byte results int

                  因為 Java 虛擬機就是這樣設(shè)計的.沒有指令集可以對字節(jié)類型執(zhí)行操作.而是 int 類型的指令集用于 booleanbytechar 的操作>短類型.

                  Because that's how the Java Virtual Machine is designed. There is no instruction set to perform operation on a byte type. Rather the instruction set for int type is used for the operation on boolean, byte, char, and short types.

                  來自 JVM 規(guī)范 - 第 2.11.1 節(jié):

                  編譯器使用 Java 虛擬機指令對 byteshort 類型的大量文字值進行編碼,這些指令將這些值符號擴展為 int 在編譯時或運行時.booleanchar 類型的文字值的加載使用在編譯時將文字零擴展為 int 類型的值的指令進行編碼或運行時.[..].因此,大多數(shù)對實際類型 booleanbytecharshort 的值的操作都是由指令正確執(zhí)行的對計算類型 int 的值進行操作.

                  A compiler encodes loads of literal values of types byte and short using Java Virtual Machine instructions that sign-extend those values to values of type int at compile-time or run-time. Loads of literal values of types boolean and char are encoded using instructions that zero-extend the literal to a value of type int at compile-time or run-time. [..]. Thus, most operations on values of actual types boolean, byte, char, and short are correctly performed by instructions operating on values of computational type int.

                  該部分也說明了這背后的原因:

                  The reason behind this is also specified in that section:

                  由于Java虛擬機的一個字節(jié)的操作碼大小,編碼類型為操作碼的地方在它的指令集的設(shè)計壓力.如果每個輸入指令支持的所有Java虛擬機的運行時間數(shù)據(jù)類型的,會有更多的指令比可以在<代碼>字節(jié)來表示.[...] 可以根據(jù)需要使用單獨的指令在不受支持和支持的數(shù)據(jù)類型之間進行轉(zhuǎn)換.

                  Given the Java Virtual Machine's one-byte opcode size, encoding types into opcodes places pressure on the design of its instruction set. If each typed instruction supported all of the Java Virtual Machine's run-time data types, there would be more instructions than could be represented in a byte. [...] Separate instructions can be used to convert between unsupported and supported data types as necessary.

                  有關(guān)所有指令集可用于各種類型的詳細信息,您可以瀏覽該部分中的表格.

                  For the details on what all instruction sets are available for various types, you can go through the table in that section.

                  還有一個表指定實際類型到JVM計算類型的映射:

                  There is also a table specifying the mapping of actual type to the JVM computational type:

                  這篇關(guān)于由于java語言規(guī)則或jvm,添加字節(jié)轉(zhuǎn)換為int?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  quot;Char cannot be dereferencedquot; error(“Char 不能被取消引用錯誤)
                  Java Switch Statement - Is quot;orquot;/quot;andquot; possible?(Java Switch 語句 - 是“或/“和可能的?)
                  Java Replace Character At Specific Position Of String?(Java替換字符串特定位置的字符?)
                  What is the type of a ternary expression with int and char operands?(具有 int 和 char 操作數(shù)的三元表達式的類型是什么?)
                  Read a text file and store every single character occurrence(讀取文本文件并存儲出現(xiàn)的每個字符)
                  Why do I need to explicitly cast char primitives on byte and short?(為什么我需要在 byte 和 short 上顯式轉(zhuǎn)換 char 原語?)

                    <legend id='lWIKz'><style id='lWIKz'><dir id='lWIKz'><q id='lWIKz'></q></dir></style></legend>
                      <tbody id='lWIKz'></tbody>

                    <small id='lWIKz'></small><noframes id='lWIKz'>

                          <bdo id='lWIKz'></bdo><ul id='lWIKz'></ul>
                        • <tfoot id='lWIKz'></tfoot>

                          • <i id='lWIKz'><tr id='lWIKz'><dt id='lWIKz'><q id='lWIKz'><span id='lWIKz'><b id='lWIKz'><form id='lWIKz'><ins id='lWIKz'></ins><ul id='lWIKz'></ul><sub id='lWIKz'></sub></form><legend id='lWIKz'></legend><bdo id='lWIKz'><pre id='lWIKz'><center id='lWIKz'></center></pre></bdo></b><th id='lWIKz'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='lWIKz'><tfoot id='lWIKz'></tfoot><dl id='lWIKz'><fieldset id='lWIKz'></fieldset></dl></div>
                          • 主站蜘蛛池模板: 日本不卡一区 | 国产综合一区二区 | 超碰日韩| 国产小视频在线观看 | xxx视频| 婷婷综合 | 国产精品久久久久久av公交车 | 欧美日韩中文字幕在线 | 久久99精品久久久久久 | 午夜精品在线观看 | 天天操操操操操 | 中日字幕大片在线播放 | 欧美日韩a| 欧美精品一区二区三区在线播放 | 大乳boobs巨大吃奶挤奶 | 免费a网站 | 美女一级a毛片免费观看97 | 99精品欧美一区二区蜜桃免费 | 亚洲国产成人在线 | 精品毛片| 久久久av中文字幕 | 免费国产精品久久久久久 | 国产一区二区精品在线 | 喷水毛片 | h在线| 久久久久久成人网 | 久久久久久久久综合 | 成人久久视频 | 国产成人精品久久二区二区91 | 精品欧美二区 | 日韩精品1区2区3区 成人黄页在线观看 | 亚洲 欧美 另类 综合 偷拍 | 福利av在线 | 亚洲精品在线视频 | 国产乱码精品一区二区三区中文 | 91中文在线观看 | 一区二区三区播放 | 91成人在线视频 | 欧美国产免费 | 亚洲一区免费视频 | 久久91|