Write a recursive method to reverse a string. Explain why you would not normally use recursion to solve this problem.

What will be an ideal response?


```
public String reverse (String text)
{
String result = text;
if (text.length() > 1)
result = text.charAt(text.length()-1)
+ reverse (text.substring(0, text.length()-1));
return result;
}

```

Computer Science & Information Technology

You might also like to view...

With an Azure RemoteApp hybrid deployment, you can…

A) Host and store all data for client applications within the Azure Cloud Platform. B) Use only your Microsoft accounts for connection credentials. C) Implement a cloud-only approach to host your applications without connecting to a local on-premises network. D) None of the above

Computer Science & Information Technology

Which could be used for permanent storage of files?

A) ROM B) Hard Disk C) EPROM D) RAM

Computer Science & Information Technology

________ and special characters are NOT allowed in bookmark names

Fill in the blank(s) with correct word

Computer Science & Information Technology

You can open the Table AutoFormat dialog box by pointing to the ____ command on the Table menu and then clicking the Table AutoFormat command.

A. Convert B. Format C. Modify D. AutoFormat

Computer Science & Information Technology