String Reverse - Java Language Basics

Java examples for Language Basics:String

Description

String Reverse

Demo Code


public class Main {
  public static void main(String args[]){
    String strOriginal = "Hello World";
    System.out.println("Original String : " + strOriginal);
    strOriginal = new StringBuffer(strOriginal).reverse().toString();
    System.out.println("Reversed String : " + strOriginal);
  }/*  ww w .  j  a v a  2  s  .  com*/
}

Result


Related Tutorials