久久久久久久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 嗎?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

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

                  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;
                  

                  這讓我很驚訝,因為該方法的返回類型是 int 類型.然而,它告訴我返回一個 char!我正在使用 eclipse,并且習慣了無窮無盡的警告和東西,這是一個重大的驚喜.

                  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 嗎?為什么會這樣?

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

                  推薦答案

                  Java 語言規范 狀態

                  當帶有 Expression 的 return 語句出現在方法中時聲明,Expression 必須 可分配(第 5.2 節) 到聲明的方法的返回類型,或發生編譯時錯誤.

                  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.

                  控制一個值是否可分配給另一個值的規則定義為

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

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

                  Assignment contexts allow the use of one of the following:

                  • 擴大原語轉換(§5.1.2)

                  原始類型的 19 種特定轉換稱為擴展原始轉換:

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

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

                  最后

                  擴展原語轉換不會丟失有關在下列情況下,數值的總大小,其中數值被完全保留:[...]

                  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 到整數類型 T 的擴展轉換將零擴展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.

                  簡而言之,作為 return 語句表達式的 char 值可通過擴展原語轉換分配給 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.

                  這篇關于Java char 也是 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='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. 主站蜘蛛池模板: 日韩在线欧美 | 亚洲一区 中文字幕 | 伊人在线视频 | 国产人成精品一区二区三 | 一区二区三区高清 | 国产美女自拍视频 | 综合久久综合久久 | 亚洲精品一区二区三区蜜桃久 | 天堂在线www | 97超碰站| 视频一区二区三区中文字幕 | 国产一区二区av | 日本久久久久久 | 很很干很很日 | 黄色片免费看视频 | 一区影院| 国产电影一区二区在线观看 | 99久久久国产精品 | 国产视频h | 天天干夜夜操 | 国产天天操 | 男人天堂午夜 | 在线资源视频 | 久久精品亚洲精品国产欧美 | 亚洲精品二区 | 99资源 | 在线观看你懂的网站 | 亚洲第一在线 | 男人午夜视频 | 日韩在线xx| 欧美黄页 | 91精品在线播放 | 一区二区三区免费观看 | 91久久精品一区二区二区 | 国产成人免费视频网站高清观看视频 | 黄色片在线 | 欧美久久久久久久久中文字幕 | 欧美片网站免费 | 成人一级片在线观看 | 成人午夜在线 | 美女三区 |