Java – StringBuffer Append() Example, StringBuffer Append() program

StringBuffer character sequence can be appended with the help of append() method in java. append() function appends characters in the end of previous character sequence of the String. StringBuffer append is fastest way to append String. Use of String append() in java is shown below.

Example of StringBuffer append() in java, JSP

public class StringBufferAppendExample {

    public static void main(String[] args) {

        StringBuffer sb = new StringBuffer();

        sb.append("Java StringBuffer");

        System.out.println("Output1 :"+sb);

        sb.append("Append StringBuffer");

        System.out.println("Output2 :"+sb);
    }
}

Output

Output1 :Java StringBuffer
Output2 :Java StringBufferAppend StringBuffer

Tags: , ,

Bookmark  

 

Leave a Reply

Security Code:

 

  Random Post