append(char c)

StringBuilder append(boolean b)
Appends the string representation of the boolean argument to the sequence.
StringBuilder append(char c)
Appends the string representation of the char argument to this sequence.
StringBuilder append(char[] str)
Appends the string representation of the char array argument to this sequence.
StringBuilder append(char[] str, int offset, int len)
Appends the string representation of a subarray of the char array argument to this sequence.
StringBuilder append(CharSequence s)
Appends the specified character sequence to this Appendable.
StringBuilder append(CharSequence s, int start, int end)
Appends a subsequence of the specified CharSequence to this sequence.
StringBuilder append(double d)
Appends the string representation of the double argument to this sequence.
StringBuilder append(float f)
Appends the string representation of the float argument to this sequence.
StringBuilder append(int i)
Appends the string representation of the int argument to this sequence.
StringBuilder append(long lng)
Appends the string representation of the long argument to this sequence.
StringBuilder append(Object obj)
Appends the string representation of the Object argument.
StringBuilder append(String str)
Appends the specified string to this character sequence.
StringBuilder append(StringBuffer sb)
Appends the specified StringBuffer to this sequence.
StringBuilder appendCodePoint(int codePoint)
Appends the string representation of the codePoint argument to this sequence.

public class Main {
  public static void main(String[] argv) {
    StringBuilder sb = new StringBuilder();
    sb.append("java2s.com");
    sb.append(123);
    sb.append(1.23);
    sb.append(true);
    System.out.println(sb.toString());

  }
}

The output:


java2s.com1231.23true

public class Main {

  public static void main(String[] argv) {

    String s1 = "Hello" + ", " + "World";
    System.out.println(s1);

    // Build a StringBuilder, and append some things to it.
    StringBuilder sb2 = new StringBuilder();
    sb2.append("Hello");
    sb2.append(',');
    sb2.append(' ');
    sb2.append("World");

    StringBuilder sb3 = new StringBuilder().append("Hello").append(',').append(' ').append("World");
    System.out.println(sb3.toString());
  }
}
Home 
  Java Book 
    Essential Classes  

StringBuilder:
  1. StringBuilder
  2. StringBuilder Constructor
  3. append(char c)
  4. StringBuilder capacity()
  5. charAt()
  6. delete(int start, int end)
  7. deleteCharAt
  8. StringBuilder length()
  9. StringBuilder reverse()
  10. setCharAt
  11. Sub string from StringBuilder
  12. toString():Convert StringBuilder to String