Write a recursive method that will reverse the order of the characters in a given string and return the result as a new string. For example, if "book" is the argument, the result would be "koob".
What will be an ideal response?
```
public static String reverse(String s){
String result;
if(s.length() == 0)
result = "";
else {
result = reverse(s.substring(1)) + s.charAt(0);
}
return result;
}
```
This code is in Methods.java.
You might also like to view...
Which command-line utility can be used to change an existing FAT16 or FAT32 partition to NTFS without losing data on the partition?
a. cipher b. convert c. encrypt d. fileconv
________ is a constructor reference. It creates a lambda that invokes the no-argument constructor of the specified class to create and initialize a new object of that class.
a. Math::sqrt b. System.out::println c. TreeMap::new d. String::toUpperCase