Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How can you reverse a string?

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


Please Help Members By Posting Answers For Below Questions

What is a substring of a string?

1163


What is string value?

1175


What does string [] args mean?

1019


How we create object in copy constructor?

1131


What does \ mean in regex?

1227


Why heap memory is called heap?

1050


What is a priority queue java?

998


Give differences between Quicksort &Mergesort. When should these sorts be used andwhat is their running time in java?

1245


What is blank final variable?

1071


What is the base class of all exception classes in java?

1060


What is java lang string?

1006


Is java 9 released?

1012


How do you detect memory leaks?

1067


How many bytes is a char in java?

1026


What is the size of int?

1085