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));
}
}
}
How to reverse String using java - learn java
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));
}
}
}
Would be nice to see it as OOP based class static and not static :)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit