A Developer Gateway To IT World...

Techie Uncle Software Testing Core Java Java Spring C Programming Operating System HTML 5 Java 8 ES6 Project

write java program to reverse string in java

import java.io.*;
import java.util.*;

/**
 *
 * @author heerababu
 */
public class reverseString {
    public static void main(String[] args) {
    String Enter="";
    System.out.println("Enter the string");
    try
      {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Enter = br.readLine();
        System.out.println("You have Entered: "+Enter);
       
        char[] cArray= Enter.toCharArray();
         System.out.print("The Reverse String will be: ");
        for (int i=cArray.length-1;i>=0;i--)
        System.out.print(cArray[i]);
      }
    catch (IOException e)
    {
       e.printStackTrace();
    }
}}

SAMPLE OUTPUT:


LEARN TUTORIALS

.

.