Java String Buffer Append() Method



This method updates the worth of the entity that appealed the technique. The process takes boolean, char, int, long, Strings, etc. StringBuffer. append(boolean a) is an inherent technique in Java that is utilized to add the string symbol of the boolean row to a given series. Parameter: This technique believes a solitary parameter a of boolean type and submits to the Boolean character value to be appended.


Here is a separate method for each primitive data type -

public StringBuffer append(boolean b)
public StringBuffer append(char c)
public StringBuffer append(char[] str)
public StringBuffer append(char[] str, int offset, int len)
public StringBuffer append(double d)
public StringBuffer append(float f)
public StringBuffer append(int i)
public StringBuffer append(long l)
public StringBuffer append(Object obj)
public StringBuffer append(StringBuffer sb)
public StringBuffer append(String str)


Here is the detail of parameters:

  • Here the parameter depends on what you are trying to append in the String Buffer.

Return Value

  • These methods return the updated StringBuffer objects.


public class Test {

   public static void main(String args[]) {
      StringBuffer sb = new StringBuffer("Test");
      sb.append(" String Buffer");

This will produce the following result:


Test String Buffer

Here at Intellinuts, we have created a complete Java tutorial for Beginners to get started in Java.