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

    <tfoot id='6mv88'></tfoot>
    • <bdo id='6mv88'></bdo><ul id='6mv88'></ul>

        <small id='6mv88'></small><noframes id='6mv88'>

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

        Java char 也是 int 嗎?

        Java char is also an int?(Java char 也是 int 嗎?)

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

                • 本文介紹了Java char 也是 int 嗎?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我正在嘗試為課程完成一些代碼:

                  I was trying to get some code done for class:

                  public int getValue(char value) {
                      if (value == 'y') return this.y;
                      else if (value == 'x') return this.x;
                  

                  由于我最終可能無法返回任何東西,所以它告訴我最后要這樣做:

                  Since I might not be able to return anything in the end, it told me to do this at the end:

                  return value;
                  

                  這讓我很驚訝,因?yàn)樵摲椒ǖ姆祷仡愋褪?int 類型.然而,它告訴我返回一個(gè) char!我正在使用 eclipse,并且習(xí)慣了無窮無盡的警告和東西,這是一個(gè)重大的驚喜.

                  This surprised me because the return type for the method was of type int. Yet, it was telling me to return a char! I'm using eclipse, and accustomed to the endless number of warnings and stuff, this was a major surprise.

                  那么,char 真的是 int 嗎?為什么會(huì)這樣?

                  So, is a char really an int? Why is this happening?

                  推薦答案

                  Java 語言規(guī)范 狀態(tài)

                  當(dāng)帶有 Expression 的 return 語句出現(xiàn)在方法中時(shí)聲明,Expression 必須 可分配(第 5.2 節(jié)) 到聲明的方法的返回類型,或發(fā)生編譯時(shí)錯(cuò)誤.

                  When a return statement with an Expression appears in a method declaration, the Expression must be assignable (§5.2) to the declared return type of the method, or a compile-time error occurs.

                  控制一個(gè)值是否可分配給另一個(gè)值的規(guī)則定義為

                  where the rules governing whether one value is assignable to another is defined as

                  賦值上下文允許使用以下之一:

                  Assignment contexts allow the use of one of the following:

                  • 擴(kuò)大原語轉(zhuǎn)換(§5.1.2)

                  原始類型的 19 種特定轉(zhuǎn)換稱為擴(kuò)展原始轉(zhuǎn)換:

                  19 specific conversions on primitive types are called the widening primitive conversions:

                  • charintlongfloat 或 `double
                  • char to int, long, float, or `double

                  最后

                  擴(kuò)展原語轉(zhuǎn)換不會(huì)丟失有關(guān)在下列情況下,數(shù)值的總大小,其中數(shù)值被完全保留:[...]

                  A widening primitive conversion does not lose information about the overall magnitude of a numeric value in the following cases, where the numeric value is preserved exactly: [...]

                  char 到整數(shù)類型 T 的擴(kuò)展轉(zhuǎn)換將零擴(kuò)展char 值的表示以填充更寬的格式.

                  A widening conversion of a char to an integral type T zero-extends the representation of the char value to fill the wider format.

                  簡(jiǎn)而言之,作為 return 語句表達(dá)式的 char 值可通過擴(kuò)展原語轉(zhuǎn)換分配給 int 的返回類型.

                  In short, a char value as the expression of a return statement is assignable to a return type of int through widening primitive conversion.

                  這篇關(guān)于Java char 也是 int 嗎?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  quot;Char cannot be dereferencedquot; error(“Char 不能被取消引用錯(cuò)誤)
                  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ù)的三元表達(dá)式的類型是什么?)
                  Read a text file and store every single character occurrence(讀取文本文件并存儲(chǔ)出現(xiàn)的每個(gè)字符)
                  Why do I need to explicitly cast char primitives on byte and short?(為什么我需要在 byte 和 short 上顯式轉(zhuǎn)換 char 原語?)
                    <legend id='zcDDv'><style id='zcDDv'><dir id='zcDDv'><q id='zcDDv'></q></dir></style></legend>
                      <tbody id='zcDDv'></tbody>
                    • <tfoot id='zcDDv'></tfoot>

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

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

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

                          1. 主站蜘蛛池模板: 亚洲欧洲成人av每日更新 | av一级一片 | 999观看免费高清www | 欧美高清视频一区 | 国产精品欧美一区二区三区不卡 | 91久久网站 | 久久久成人动漫 | 欧美成人免费在线 | 国产专区在线 | 中文二区| 日日做夜夜爽毛片麻豆 | 久久久久99 | 色性av | 精品成人av| www.国产精| 国产精品久久久久久久一区探花 | 久久国产高清视频 | 鸡毛片 | 欧美一区二区三区在线播放 | 日韩1区| 毛片网站在线观看 | 久久激情五月丁香伊人 | 亚洲精品日韩综合观看成人91 | 天堂一区二区三区四区 | 国外成人在线视频 | 亚洲免费在线观看av | 国产99久久久国产精品 | 久久一二 | 亚洲福利av | 视频一区在线观看 | 免费看色 | 免费久久精品视频 | 夜夜精品视频 | 国精产品一区二区三区 | 欧美日韩专区 | 欧美精品一二区 | 羞羞视频免费观 | 国产成人高清在线观看 | 色婷婷影院| 亚洲第一在线 | 在线精品一区二区三区 |