by Dinesh Thakur Category: array

String toString () : This method returns the value of the invoking StringBuffer object that invoked the method as a string. For example: The statement,

String s = s1.toString();

The String object s will contain "Hello Java".

public class StringBuffertoString

{
        public static void main(String[] args)
     {
            StringBuffer sl = new StringBuffer("Hello Java");
            System.out.println("sl.toString() : " + sl.toString());      
      }
}

StringBuffer toString() Java Example



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles