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 a substring of a string?
What is string value?
What does string [] args mean?
How we create object in copy constructor?
What does \ mean in regex?
Why heap memory is called heap?
What is a priority queue java?
Give differences between Quicksort &Mergesort. When should these sorts be used andwhat is their running time in java?
What is blank final variable?
What is the base class of all exception classes in java?
What is java lang string?
Is java 9 released?
How do you detect memory leaks?
How many bytes is a char in java?
What is the size of int?