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 does this () mean in constructor chaining concept?

1118


what is encapsulation in java? Explain

1103


What is protected access modifier?

1000


What are thread priorities and importance of thread priorities in java?

1130


What are the new features in java 8?

1012


Can inner class be public in java?

1010


Is string serializable in java?

1011


What is unicode datatype?

960


Explain enumeration in java?

997


Are arrays immutable in java?

1077


What is class and its types?

1029


What is the difference between abstract classes and interfaces?

1013


Can we initialize the final blank variable?

1086


Where are variables stored?

967


How is abstraction implemented in java ?

989