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

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # Java - `String contentEquals()`方法 > 原文: [https://beginnersbook.com/2013/12/java-string-contentequals-method-example/](https://beginnersbook.com/2013/12/java-string-contentequals-method-example/) 方法`contentEquals()`將`String`與`String Buffer`進行比較并返回一個布爾值。如果`String`與`String`緩沖區匹配,則返回`true`,否則返回`false`。 `boolean contentEquals(StringBuffer sb)` ### 例 在這個例子中,我們有兩個字符串和兩個字符串緩沖區。我們使用`contentEquals()`方法比較字符串和字符串緩沖區。這里我們通過直接調用`System.out.println`語句中的方法來顯示結果。但是,您也可以將返回的值存儲在布爾變量中,并進一步使用它:`boolean var = str1.contentEquals(sb1);` ```java public class ContentEqualsExample { public static void main(String args[]) { String str1 = "First String"; String str2 = "Second String"; StringBuffer str3 = new StringBuffer( "Second String"); StringBuffer str4 = new StringBuffer( "First String"); System.out.println("str1 equals to str3:"+str1.contentEquals(str3)); System.out.println("str2 equals to str3:"+str2.contentEquals(str3)); System.out.println("str1 equals to str4:"+str1.contentEquals(str4)); System.out.println("str2 equals to str4:"+str2.contentEquals(str4)); } } ``` 輸出: ```java str1 equals to str3:false str2 equals to str3:true str1 equals to str4:true str2 equals to str4:false ```
                  <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>

                              哎呀哎呀视频在线观看