RE: How to reverse String using java - learn java

You are viewing a single comment's thread from:

How to reverse String using java - learn java

in programming •  7 years ago 

You can do it without the character array:

class Reversestring
{
  public static void main(String args[])
  {
    String s="ravikumar";
    for(int i=s.length()-1;i>=0;i--)
    {
      System.out.print(s.charAt(i));
    }
  }
}
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Would be nice to see it as OOP based class static and not static :)