Answer Posted / milind s
Most of time in interview asked without using Build Function**
public String reverse(String arg)
{
String tmp = null;
if (arg.length() == 1)
{
return arg;
}
else
{
String lastChar = arg.substring(arg.length() - 1,
arg.length());
String remainingString = arg.substring(0,
arg.length() - 1);
tmp = lastChar + reverse(remainingString);
return tmp;
}
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
what is the difference between a threads start() and run() methods? : Java thread
What is hashtable and explain features of hashtable?
What is the return type of the main method?
What is meant by flickering?
Can we override tostring method in java?
Is map sorted in java?
What is the instance of an object?
How are observer and observable used in java programming?
What do you understand by overloading and overriding in java?
What does three dots mean in java?
Is there is any difference between a scrollbar and a scrollpane?
what is optional in java 8?
What happens when you add a double value to a string?
Can inner class final?
Why is singleton instance static?