<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                # Java 程序:查找字符的 ASCII 值 > 原文: [https://www.programiz.com/java-programming/examples/ascii-value-character](https://www.programiz.com/java-programming/examples/ascii-value-character) #### 在此程序中,您將學習查找并顯示 Java 中字符的 ASCII 值。 這是通過類型轉換和常規變量分配操作完成的。 ## 示例:查找字符的 ASCII 值 ```java public class AsciiValue { public static void main(String[] args) { char ch = 'a'; int ascii = ch; // You can also cast char to int int castAscii = (int) ch; System.out.println("The ASCII value of " + ch + " is: " + ascii); System.out.println("The ASCII value of " + ch + " is: " + castAscii); } } ``` 運行該程序時,輸出為: ```java The ASCII value of a is: 97 The ASCII value of a is: 97 ``` * * * 在上述程序中,字符`a`存儲在`char`變量`ch`中。 就像使用雙引號`(" ")`聲明字符串一樣,我們使用單引號`(' ')`聲明字符。 現在,要查找`ch`的 ASCII 值,我們只需將`ch`分配給`int`變量`ascii`。 在內部,Java 將字符值轉換為 ASCII 值。 我們也可以使用`(int)`將字符`ch`轉換為整數。 簡單來說,**強制轉換**將變量從一種類型轉換為另一種類型,此處`char`變量`ch`被轉換為`int`變量`castAscii`。 最后,我們使用`println()`函數打印 ascii 值。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看