Write a recursive method that takes a String parameter and prints out the characters of the string in reverse order.
What will be an ideal response?
public static void reverse(String s)
{
if (s.length() == 0)
return;
char lastChar = s.charAt(s.length() – 1);
System.out.print(lastChar);
reverse(s.substring(0, s.length() – 1));
}
Computer Science & Information Technology
You might also like to view...
The File History utility keeps four past copies of your important files
Indicate whether the statement is true or false
Computer Science & Information Technology
Which of the following is contained in the first sector of the hard disk?
A. Operating system B. Master file table C. Boot sector D. Master boot record
Computer Science & Information Technology