<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>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # Java `String.endsWith()`方法示例 > 原文: [https://howtodoinjava.com/java/string/java-string-endswith-method/](https://howtodoinjava.com/java/string/java-string-endswith-method/) [Java 字符串](https://howtodoinjava.com/java-string/)`endsWith()`方法用于檢查字符串的后綴。 它驗證給定的字符串是否以參數字符串結尾。 ## 1\. Java `String.endsWith(String str)`方法 檢查字符串是否以后綴參數字符串`'str'`結尾的 Java 程序。 ```java public class Main { public static void main(String[] args) { String blogName = "howtodoinjava.com"; System.out.println( blogName.endsWith("com") ); //true System.out.println( blogName.endsWith("net") ); //false } } ``` 程序輸出。 ```java true false ``` > `String.endsWith()`方法不接受**正則表達式**作為參數。 如果我們以*正則表達式*模式作為參數傳遞,它將僅被視為普通字符串。 #### 1.1 不允許使用`null`方法參數 請注意,不允許將`null`作為`endsWith()`方法的方法參數。 如果傳遞了`null`,它將拋出`NullPointerException`。 ```java public class StringExample { public static void main(String[] args) { String blogName = "howtodoinjava.com"; System.out.println( blogName.endsWith(null) ); } } ``` 程序輸出: ```java Exception in thread "main" java.lang.NullPointerException at java.lang.String.endsWith(String.java:1436) at com.StringExample.main(Main.java:11) ``` 參考: [Java `String`文檔](https://docs.oracle.com/javase/10/docs/api/java/lang/String.html)
                  <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>

                              哎呀哎呀视频在线观看