JAVA program for StringBuffer method toString()
This JAVA program is to convert StringBuffer object to a string using StringBuffer method toString().
StringBuffer method toString() converts stringbuffer data into a string.
Program
import java.util.*; class sb10 { public static void main(String args[]) { String str; Scanner sc = new Scanner(System.in); System.out.println("Enter the string"); str = sc.nextLine(); StringBuffer s = new StringBuffer(str); System.out.println("On using toString() = "+s.toString()); } }