You are here: Home / Topics / toString() method in spring buffer in Java

toString() method in spring buffer in Java

Filed under: Java on 2023-08-23 18:58:36

// Program to explain the following StringBuffer function :
//String toString()

class  MtoString
{
public static void main( String args[ ] )
{
 StringBuffer sb = new StringBuffer( "Java Programming Examples." );
 
 String s = sb.toString();

 System.out.println( " String = " + s ); 
}
}


Output:

 String = Java Programming Examples.

About Author:
J
Java     View Profile
Hi, I am using MCQ Buddy. I love to share content on this website.