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

    1. <small id='N5hbG'></small><noframes id='N5hbG'>

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

        在 Java 中使用 == 運算符比較包裝器對象

        Using == operator in Java to compare wrapper objects(在 Java 中使用 == 運算符比較包裝器對象)
        <legend id='KJvTL'><style id='KJvTL'><dir id='KJvTL'><q id='KJvTL'></q></dir></style></legend>
          <tbody id='KJvTL'></tbody>

          • <i id='KJvTL'><tr id='KJvTL'><dt id='KJvTL'><q id='KJvTL'><span id='KJvTL'><b id='KJvTL'><form id='KJvTL'><ins id='KJvTL'></ins><ul id='KJvTL'></ul><sub id='KJvTL'></sub></form><legend id='KJvTL'></legend><bdo id='KJvTL'><pre id='KJvTL'><center id='KJvTL'></center></pre></bdo></b><th id='KJvTL'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='KJvTL'><tfoot id='KJvTL'></tfoot><dl id='KJvTL'><fieldset id='KJvTL'></fieldset></dl></div>
          • <small id='KJvTL'></small><noframes id='KJvTL'>

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

              1. <tfoot id='KJvTL'></tfoot>

                  本文介紹了在 Java 中使用 == 運算符比較包裝器對象的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在閱讀 Kathy Sierra 和 Bert Bates 的 SCJP Java 6,這本書讓我非常困惑.在第 245 頁上,他們聲明以下代碼.

                  I'm reading SCJP Java 6 by Kathy Sierra and Bert Bates and this book is confusing me so much. On page 245 they state that the following code below.

                  Integer i1 = 1000;
                  Integer i2 = 1000;
                  if(i1 != i2)
                  System.out.println("different objects");
                  
                  //Prints output
                  different objects
                  

                  然后在下一頁他們有以下代碼

                  Then on the very next page they have the following code

                  Integer i3 = 10;
                  Integer i4 = 10;
                  if(i3 == i4)
                  System.out.println("same objects");
                  
                  //Prints output
                  same objects
                  

                  我很困惑!當我自己嘗試時,您似乎無法使用 == 來比較使用 equals() 方法的相同方式.即使整數變量設置為相同的值(即 10),使用 == 總是會給我假".我對么?使用 == 比較相同的 Integer 對象(具有相同的值)將始終導致 'false'

                  I'm so confused! When I try this out on my own it seems that you cannot use the == to compare the same way you would use equals() method. Using the == always gives me 'false' even if the Integer variables are set to the same value (i.e. 10). Am I correct? Using the == to compare the same Integer object (with same values) will always result in 'false'

                  推薦答案

                  答案的關鍵就叫object interning.Java 實習生的數字很小(小于 128),因此所有 Integer(n) 的實例與 n 在實習范圍內都是相同的.大于或等于 128 的數字不會被保留,因此 Integer(1000) 對象彼此不相等.

                  The key to the answer is called object interning. Java interns small numbers (less than 128), so all instances of Integer(n) with n in the interned range are the same. Numbers greater than or equal to 128 are not interned, hence Integer(1000) objects are not equal to each other.

                  這篇關于在 Java 中使用 == 運算符比較包裝器對象的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  How can I detect integer overflow on 32 bits int?(如何檢測 32 位 int 上的整數溢出?)
                  Local variables before return statements, does it matter?(return 語句之前的局部變量,這有關系嗎?)
                  How to convert Integer to int?(如何將整數轉換為整數?)
                  How do I create an int array with randomly shuffled numbers in a given range(如何在給定范圍內創建一個隨機打亂數字的 int 數組)
                  Inconsistent behavior on java#39;s ==(java的行為不一致==)
                  Why is Java able to store 0xff000000 as an int?(為什么 Java 能夠將 0xff000000 存儲為 int?)
                    • <bdo id='FLybb'></bdo><ul id='FLybb'></ul>
                        <tbody id='FLybb'></tbody>

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

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

                            主站蜘蛛池模板: 国产精品免费av | 成人欧美一区二区三区黑人孕妇 | 国产99热 | 久热免费| 免费看黄视频网站 | 天天干天天干 | 国产欧美精品一区二区色综合朱莉 | 精品久久香蕉国产线看观看亚洲 | 91精品国产91久久久久久不卞 | 91免费视频观看 | 欧美三级免费观看 | 四虎最新| 国产一级片免费视频 | 久久久一二三 | 中文字幕av亚洲精品一部二部 | www.888www看片 | 色伊人网 | 国产高清在线观看 | 精品国产成人 | 精品视频在线一区 | 美女久久久久久久久 | www日本在线观看 | 在线看日韩 | 正在播放一区二区 | 日韩欧美大片 | 欧美人妖网站 | 美女一区| 国产 日韩 欧美 在线 | 欧美乱码精品一区二区三区 | 美女视频网站久久 | 亚洲国产成人av好男人在线观看 | 性高朝久久久久久久3小时 av一区二区三区四区 | www.黄色片视频 | 亚洲国产福利视频 | 精品久久久久久久 | 国产精品亚洲视频 | 丝袜美腿一区二区三区 | 蜜臀网 | 亚洲精品66| 午夜精品久久 | 色婷婷亚洲国产女人的天堂 |