Reverse a String in Java


public class Test1 {

 public static void main(String aa[])
 {
  String name = "hello";
  int len;
        len= name.length();
        for(int i=(len-1);i>=0;i--)
        {
         System.out.print(name.charAt(i));
         }
 }
}

No comments :

No comments :

Post a Comment