by Dinesh Thakur Category: array

StringBuffer reverse () : This method reverse the character sequence contained in the string buffer. In other words, the first character becomes the last, the second character becomes the second last and so on. For example, The Word “welcome” after reverse.

S1. reverse () will return emoclew.

Here is the Java Example for StringBuffer reverse():

public class StringBufferReverse

{
          static void ReverseString()
          {
              String a ="Dinesh Thakur";
              System.out.println("\nOriginal String : " + a);
              StringBuffer b = new StringBuffer(a).reverse();
              System.out.println("Reverse character string : "+b);
         }
              public static void main(String[] args)
               {
                    ReverseString();
               }
}

StringBuffer reverse() in 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.



Search Content







Popular Article