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

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

      <tfoot id='oBB36'></tfoot>
    1. <small id='oBB36'></small><noframes id='oBB36'>

      <legend id='oBB36'><style id='oBB36'><dir id='oBB36'><q id='oBB36'></q></dir></style></legend>
    2. 為什么我需要在 byte 和 short 上顯式轉換 char 原語

      Why do I need to explicitly cast char primitives on byte and short?(為什么我需要在 byte 和 short 上顯式轉換 char 原語?)

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

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

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

            <tfoot id='IZHxQ'></tfoot>
              • <legend id='IZHxQ'><style id='IZHxQ'><dir id='IZHxQ'><q id='IZHxQ'></q></dir></style></legend>
              • 本文介紹了為什么我需要在 byte 和 short 上顯式轉換 char 原語?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                關于原語:當我從較小的類型轉換為較大的類型時,轉換是隱式的,當我從較大的類型轉換為較小的類型時,我需要顯式地轉換原語,由于數(shù)據(jù)丟失,這很明顯.但有些東西我不明白.當我在某些情況下(字節(jié)和短)向上或向下轉換為 char 時,我總是需要在兩個方向上顯式轉換,盡管 byte(8 位)適合 char(16 位)?

                Concerning primitives: When I cast from smaller to bigger types, the casts are implicit, when I cast from bigger to smaller types, I need to explicitly cast the primitives, that's clear due to loss of data. But there is something I don't get. When I up- or downcast to char in some cases (byte and short), I always need to explicitly cast in both directions although byte (8bit) fits into char (16bit)?

                (另請參見 http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html)

                看我的例子...

                public class CastingTest
                {
                    public static void main(String[] args)
                    {
                        //casting from smaller to bigger types
                        short c = 13;
                        int d = c;
                
                        byte f = 34;
                        short g = f;
                
                        byte h = 20;
                        long i = h;
                
                        byte var03 = 6;
                        double var04 = var03;   
                
                        //casting from bigger to smaller types
                        int j = 12;
                        short k = (short)j;
                
                        long m = 56;
                        int n = (int)m;
                
                        double o = 19;
                        short p = (short)o;
                
                        //not possible without explicit cast, but why?
                        byte var01 = 3;
                        char var02 = (char)var01;
                
                        short var05 = 5;
                        char var06 = (char)var05;
                
                        char var07 = 'k';
                        short var08 = (short)var07;
                    }
                }
                

                推薦答案

                char 是 Java 唯一的 unsigned 類型,因此它的取值范圍不完全包含任何其他 Java 類型的值范圍.

                char is Java's only unsigned type, therefore its value range does not fully contain any other Java type's value range.

                對于目標類型范圍未完全覆蓋源類型范圍的任何轉換,您必須使用顯式轉換運算符.

                You must use an explicit cast operator for any conversion where the target type's range doesn't fully cover the source type's range.

                這篇關于為什么我需要在 byte 和 short 上顯式轉換 char 原語?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權益,請聯(liá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)的每個字符)
                What#39;s the best way to check if a character is a vowel in Java?(在 Java 中檢查字符是否為元音的最佳方法是什么?)
                <i id='clSFX'><tr id='clSFX'><dt id='clSFX'><q id='clSFX'><span id='clSFX'><b id='clSFX'><form id='clSFX'><ins id='clSFX'></ins><ul id='clSFX'></ul><sub id='clSFX'></sub></form><legend id='clSFX'></legend><bdo id='clSFX'><pre id='clSFX'><center id='clSFX'></center></pre></bdo></b><th id='clSFX'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='clSFX'><tfoot id='clSFX'></tfoot><dl id='clSFX'><fieldset id='clSFX'></fieldset></dl></div>

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

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

                      • <small id='clSFX'></small><noframes id='clSFX'>

                          <tbody id='clSFX'></tbody>
                          <tfoot id='clSFX'></tfoot>
                          主站蜘蛛池模板: 久久精品国产一区 | 91私密视频 | 亚洲国内精品 | 日韩一级不卡 | 亚洲综合在线视频 | 国产探花在线精品一区二区 | 欧美男人天堂 | 色爱综合网 | 亚洲综合日韩精品欧美综合区 | 噜噜噜色网 | 日韩欧美一区在线 | 国产区高清 | 美女网站视频免费黄 | 亚洲精品乱码久久久久久按摩观 | 伊人二区| 成人精品一区二区三区四区 | 高清一区二区三区 | 精品一区二区三区四区五区 | 在线精品亚洲欧美日韩国产 | 精品视频一区二区三区在线观看 | 天天躁日日躁狠狠躁白人 | 久久久精品一区二区三区 | 一区二区免费在线 | 国产精品毛片久久久久久久 | 九九在线视频 | 中文字幕11页 | 精品一区二区三区四区 | 欧美日韩在线精品 | 久久久国产精品一区 | 日韩无 | 国产精品mv在线观看 | 欧美日韩一区二区电影 | 黑人巨大精品欧美一区二区免费 | 日韩成人高清在线 | 色婷婷久久久亚洲一区二区三区 | 国产精品精品久久久 | 男人影音| 精品伊人 | 国产精品成人一区 | 久久久精品网站 | 成人污污视频 |