2 Comments

  1. venkat gummadi

    import java.util.Scanner;
    class Test3 {
    public static void main(String[] args) {
    System.out.println(“Enter A String value:”);
    String s=new Scanner(System.in).nextLine();
    char ch[]=s.toCharArray();
    for(int i=ch.length-1;i>=0;i–){
    System.out.print(ch[i]);
    }
    }
    }

    Reply

  2. There is one more question asked in this areas.

    Reverse a string without using any variable ,string buffer, builder etc

    String str = “Hi Parag!”;
    for (int i = 0; i < str.length(); i++) {
    str = str.substring(1, str.length() – i)
    + str.substring(0, 1)
    + str.substring(str.length() – i, str.length());
    }

    Reply

Leave a Reply.. code can be added in <code> </code> tags