Java examples for Language Basics:StringBuffer
To convert StringBuffer to String object, use String toString() method of StringBuffer class.
public class Main { public static void main(String args[]) { StringBuffer sbf = new StringBuffer("Hello World!"); String str = sbf.toString();// ww w . java 2 s . c om System.out.println("StringBuffer to String: " + str); } }