[!INDEX]

  1. String Buffer
  2. Code Example+ use append hello + world
  3. Syntax (ASC)
  4. StringBuilder
  5. Code Example+ use append hello + world
  6. constructor+method

1. String Buffer

[!NOTE]

  1. (Mutable, synchronized, thread safe, multi-threaded context, multiple modifications to a string )

2. Code Example+ use append hello + world

StringBuffer sb = new StringBuffer("Hello");
sb.append(" World");  // Modifies the existing object
System.out.println(sb.toString());  // Output: Hello World

3. Syntax (ASC)

public final class StringBuffer extends AbstractStringBuilder 
                                implements java.io.Serializable, CharSequence {
}

4. StringBuilder

[!NOTE]

  1. (Mutable, not synchronized, no thread safe, single-threaded environments, modified frequently.)

5. Code Example+ use append hello + world

StringBuilder sb = new StringBuilder("Hello");
sb.append(" World");  // Modifies the existing object
System.out.println(sb.toString());  // Output: Hello World

6. constructor+method