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

    1. <tfoot id='X9ERY'></tfoot>
    2. <small id='X9ERY'></small><noframes id='X9ERY'>

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

        C++ 或 Java 中的類型轉換和類型轉換有什么區別

        What is the difference between type casting and type conversion in C++ or Java?(C++ 或 Java 中的類型轉換和類型轉換有什么區別?)

          <tbody id='wKjzu'></tbody>

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

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

                <legend id='wKjzu'><style id='wKjzu'><dir id='wKjzu'><q id='wKjzu'></q></dir></style></legend>
                • 本文介紹了C++ 或 Java 中的類型轉換和類型轉換有什么區別?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  C++ 或 Java 中的類型轉換和類型轉換有什么區別?

                  What is the difference between typecasting and typeconversion in C++ or Java ?

                  推薦答案

                  類型 casting 將變量引用的值(內存塊)視為不同于聲明變量的類型.

                  Type casting is treating a value (block of memory) referenced by a variable as being of a different type than the type the variable is declared as.

                  類型 conversion 實際上是在執行該值的轉換.

                  Type conversion is actually performing a conversion of that value.

                  在許多語言中,一些 類型轉換(通常是數字類型)確實會導致轉換(這會因語言而異),但大多數情況下只是將此 X 視為 Y".

                  In many languages, some casts (usually numeric ones) do result in conversions (this will vary quite a bit by language), but mostly it's just "treat this X as a Y".

                  與人類語言的大多數方面一樣,不幸的是,這些術語在不同社區的使用方式略有不同,主要是沿語言線.例如,請參閱下面 James 對 C++ 的評論 —那里的cast"一詞的含義比上面的定義要廣泛得多,后者更多地是在 C 或 Java 模型中.為了讓事情變得有趣,Java 語言規范實際上包含了各種種類 類型,包括 強制轉換.但以上是一個很好的經驗法則.

                  Like most aspects of human language, unfortunately the terms are used slightly differently in different communities, mostly along language lines. For instance, see James' comment below about C++ — the word "cast" there has a much broader meaning than the above definition, which is more in the C or Java mold. And just to make things fun, the Java Language Spec actually gets into various kinds of casts, including casting conversions. But the above is a good rule of thumb.

                  但舉個簡單的例子:

                  在 Java 中,在泛型之前,在處理地圖時必須進行大量的類型轉換并不罕見:

                  In Java, prior to generics it wasn't unusual to have to do a lot of typecasting when dealing with maps:

                  Map m = new HashMap();
                  m.put("one", "uno");
                  
                  // This would give a compiler error, because although we know
                  // we'll get a String back, all the compiler knows is that it's
                  // an Object
                  String italian = m.get("one");
                  
                  // This works, we're telling the compiler "trust me, it's a String"
                  String italian = (String)m.get("one");
                  

                  幸運的是,添加 generics 解決了這個問題,因為以這種方式進行投射往往是一種存在維護問題的脆弱流程.

                  Fortunately, the addition of generics addressed this, as casting in this way tends to be a fragile process with maintenance issues.

                  相比之下,如果你有一個數字字符串,你會轉換:

                  In contrast, you'd convert if you had a String of digits:

                  String s = "1234";
                  

                  ...并且需要知道這些數字以十進制表示的數字:

                  ...and needed to know what number those digits represented in decimal:

                  // Wrong (cast)
                  int n = (int)s;
                  
                  // Right (conversion)
                  int n = Integer.parseInt(s, 10);
                  

                  這篇關于C++ 或 Java 中的類型轉換和類型轉換有什么區別?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='PNwxh'><style id='PNwxh'><dir id='PNwxh'><q id='PNwxh'></q></dir></style></legend>

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

                    <tfoot id='PNwxh'></tfoot>

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

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

                            主站蜘蛛池模板: 一级片网址| 天天综合天天 | av国产精品毛片一区二区小说 | 麻豆国产一区二区三区四区 | 91国在线 | 亚洲欧美视频 | 亚洲欧美日韩在线 | 欧美一级二级三级视频 | 精品国产一区二区久久 | 九色 在线 | 精品国产乱码久久久久久a丨 | 免费一级黄色电影 | 久久久精品一区 | 国产精品久久久久不卡 | 黄色精品 | 久久99久久久久 | 国产一区二区三区免费视频 | 亚洲伊人久久综合 | 亚洲精品一区中文字幕乱码 | 一级片免费视频 | 密桃av | 中文在线播放 | 日韩精品 电影一区 亚洲 | 欧美日韩国产一区 | 中文字幕第一页在线 | 视频一区二区在线观看 | 在线一区视频 | 久热精品视频 | 亚洲精品久久久久久久久久吃药 | 久草色视频 | 精品中文在线 | 久久久久久一区 | 成人精品福利 | 中文字幕 视频一区 | 日日干夜夜操 | 亚洲成人免费观看 | 午夜天堂精品久久久久 | 亚洲精品久久 | 综合亚洲视频 | 精品一二三 | 国产精品视频一区二区三区四蜜臂 |