約 48,100 件の結果
リンクを新しいタブで開く
  1. String vs Stringbuffer の検索結果を含めています。
    String vs Stringbuff の検索結果のみを表示しますか?
  2. In Java, String and StringBuffer are both used to handle sequences of characters, but they differ significantly in mutability, thread-safety, and performance.

    String objects are immutable — once created, their value cannot be changed. Any modification like concatenation results in the creation of a new object, which can lead to higher memory usage and slower performance for frequent changes. Example:

    String str = "Hello";
    str.concat(" World"); // Creates a new String object
    System.out.println(str); // Output: Hello
    コピーしました。

    StringBuffer, on the other hand, is mutable — you can modify its content without creating new objects. It is also thread-safe because all its methods are synchronized, making it suitable for multi-threaded environments. Example:

    StringBuffer sb = new StringBuffer("Hello");
    sb.append(" World"); // Modifies the same object
    System.out.println(sb); // Output: Hello World
    コピーしました。

    Key Differences:

    フィードバック
    ありがとうございました!詳細をお聞かせください
  3. string・StringBuffer・StringBuilderの特徴&性能比較 - Qiita

    Javaには文字列を扱うにはStringStringBuffer、StringBuilder3つの参照型クラスがあります。 この3つは「文字列を扱う」という共通点がありますが、それぞれの特徴 …
    Stringbuffer・Stringbuilderとは

    StringBuffer・StringBuilderは文字列の演算(結合または変更)するとき、主に使われます。 もちろん、Stringも+演算やconcat()メソッドを使って文字列を結合することができます。 しかし、Stringの+演算で文字列を結合すると、結合された文 …

    Stringと(Stringbuffer、Stringbuilder)を比較

    文字列結合の性能比較
    Javaで文字列を結合する方法は4つあります。 +演算、String.concat()メソッド、StringBuffer、StringBuilderでそれぞれの特徴について説明します。

  4. String vs StringBuilder vs StringBuffer in Java - GeeksforGeeks

    2025年10月11日 · If a string can change and will be accessed from multiple threads, use a StringBuffer because StringBuffer is synchronous, so you have thread-safety. If you don't want thread-safety than …

  5. String vs. StringBuffer - What's the Difference? | This vs. That

    However, there are some key differences between the two. String objects are immutable, meaning that once a String is created, its value cannot be changed. On the other hand, StringBuffer objects are …

  6. Difference between String and StringBuffer in Java

    2026年1月10日 · In Java, String is an immutable object that is used to store a sequence of characters, whereas StringBuffer is a mutable object that allows …

    コード サンプル

    System.out.println(str.hashCode());
    System.out.println("Hashcode test of StringBuffer:");
    StringBuffer sb=new StringBuffer("java");
    System.out.println(sb.hashCode());
    sb.append("tpoint");...
    javatpoint についてさらに表示
    フィードバック
    ありがとうございました!詳細をお聞かせください
  7. String vs StringBuffer in Java with Example …

    Use String when you need a fixed, immutable sequence of characters, and you are sure that the content won't change frequently. Use StringBuffer when you need to …

  8. 他の人も質問しています
  9. String vs StringBuffer | Top 7 Differences You Should …

    2023年3月24日 · Guide to String vs StringBuffer. Here we discuss the String vs StringBuffer key differences with infographics and comparison table.

  10. Differences between String and StringBuffer - Online Tutorials Library

    2020年9月9日 · String is an immutable class and its object can’t be modified after it is created but definitely reference other objects. They are very useful in multithreading environment because …

  11. String vs StringBuffer in Java: Key Differences and Usages

    Discover the key differences between String and StringBuffer in Java, including performance implications, usage scenarios, and best practices.

  12. String Vs StringBuffer in Java - javabytechie

    2023年1月22日 · The StringBuffer class is used to create a mutable String object (the object can be changed once created). StringBuffer is similar to the String class except for one major difference: …

  13. String vs Stringbuffer の検索結果を含めています。
    String vs Stringbuff の検索結果のみを表示しますか?