public class reverseString
{
public static void main(String[] args)
{
String original="java";
String reverse="";
int length=original.length();
for(int i=length-1;i>=0;i--)
{
reverse=reverse+original.charAt(i);
}
System.out.println(reverse);
}
}
Output:
avaj
No comments:
Post a Comment