public class ReverseString {
public static String rev(String s) {
if (s.length() == 0) {
return "";
} else {
return s.charAt(s.length() - 1)
+ rev(s.substring(0, s.length() - 1));
}
}
public static void main(String args[]) {
String s = new String("hello");
System.out.println(rev(s));
}
}