Posts Tagged StringBuffer

Java – StringBuffer Example, StringBuffer program

Sunday, October 11th, 2009

StringBuffer is mutable sequence of characters. It can store character, append character, delete character easily. StringBuffer is a thread safe sequence of characters, and it is synchronized. StringBuffer is like a normal String but it can modify at any point. StringBuffer can easily use in multi thread programs. Use of StringBuffer in java is shown below.

Example of StringBuffer in java, JSP

public class StringBufferExample {

    public static void main(String[] args) {

        StringBuffer sb = new StringBuffer();

        sb.append("Java StringBuffer");

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

Output

Output :Java StringBuffer