Reverse A String
      In this program the characters of an array are reversed using reverse method of StringBuffer class. We use StringBuffer class because we cannot modify String class variables.
/*
	http://www.ProbCOMP.com
	
	In this program the characters of an array are reversed using
	reverse method of StringBuffer class. We use StringBuffer class
	because we cannot modify String class variables.

*/

 public class ReverseString {
	public static void main(String args[]) {

		String str = "The capital of India is Delhi";
        System.out.println("\nOriginal string: " + str);

        StringBuffer revstr = new StringBuffer(str).reverse();
        System.out.println("Reverse string: " + revstr);
	}
}
									

Download Program
Did You Know ?
IP address is a numerical label that is assigned to devices participating in a computer network. Read More