久久久久久久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語言規則或jvm,添加字節轉換為int?

        Is addition of byte converts to int because of java language rules or because of jvm?(由于java語言規則或jvm,添加字節轉換為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語言規則或jvm,添加字節轉換為int?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  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 有關或它是用 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支持的字節數據類型,那么為什么<代碼>上字節操作結果<代碼> INT

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

                  推薦答案

                  如果java支持字節數據類型,那么為什么對字節的操作結果是int

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

                  因為 Java 虛擬機就是這樣設計的.沒有指令集可以對字節類型執行操作.而是 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 規范 - 第 2.11.1 節:

                  編譯器使用 Java 虛擬機指令對 byteshort 類型的大量文字值進行編碼,這些指令將這些值符號擴展為 int 在編譯時或運行時.booleanchar 類型的文字值的加載使用在編譯時將文字零擴展為 int 類型的值的指令進行編碼或運行時.[..].因此,大多數對實際類型 booleanbytecharshort 的值的操作都是由指令正確執行的對計算類型 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虛擬機的一個字節的操作碼大小,編碼類型為操作碼的地方在它的指令集的設計壓力.如果每個輸入指令支持的所有Java虛擬機的運行時間數據類型的,會有更多的指令比可以在<代碼>字節來表示.[...] 可以根據需要使用單獨的指令在不受支持和支持的數據類型之間進行轉換.

                  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.

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

                  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:

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

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

                  相關文檔推薦

                  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 操作數的三元表達式的類型是什么?)
                  Read a text file and store every single character occurrence(讀取文本文件并存儲出現的每個字符)
                  Why do I need to explicitly cast char primitives on byte and short?(為什么我需要在 byte 和 short 上顯式轉換 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>
                          • 主站蜘蛛池模板: 久草视频在线播放 | 亚洲不卡| 国产午夜视频 | 亚洲影音先锋 | 91精品在线观看入口 | 天天夜夜人人 | 日韩欧美手机在线 | 色吧综合 | 午夜av电影 | 超碰电影 | 色婷婷精品久久二区二区蜜臂av | 高清欧美性猛交xxxx黑人猛交 | 特级特黄特色的免费大片 | 日本淫视频 | 久久精品欧美一区二区三区麻豆 | www.中文字幕.com | 人人插人人 | 天堂成人国产精品一区 | 久草新在线| 亚洲一区播放 | 亚洲成人一区二区三区 | 亚洲精品一区二三区不卡 | 理论片免费在线观看 | 日韩在线视频网址 | 国产精品日日夜夜 | 一级黄色淫片 | 免费国产一区 | 九九免费在线视频 | 久久在视频 | 最新中文字幕在线 | 综合九九 | 国产人成精品一区二区三 | 国产午夜视频 | 成人免费在线网 | 91亚洲精品在线观看 | 精品久久久久久久久久 | 久久丁香 | 日本免费小视频 | 久久一区二区三区免费 | 国产在线激情视频 | 97国产在线观看 |