Friday, November 4, 2011

Recursive method to reverse String without making use of Length method

public static String reverseString(String str)
{

try
{
char chr = str.charAt(0);
return reverseString(str.substring(1)) + chr;

}
catch (Exception e)
{

return str;
}
//return null;
}