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
Can one thread block the other thread?
What is a protected void?
What is method overriding in java ?
What is empty string literal in java?
What is a predicate method?
How to calculate the length of a singly linked list in java?
Why inputstreamreader is used in java?
What does escaping a character mean?
What is double word?
What happens when I use / and % with a negative numerator?
If goto and const is reserve words than why it is not work in java?
What is void class in java?
what are abstract functions?
What are the types of java?
Are true and false keywords?