Question: Can someone tell me what's wrong with this program? It's supposed to be a recursive method. /** This program demonstrates a solution to the String

Can someone tell me what's wrong with this program? It's supposed to be a recursive method.

/** This program demonstrates a solution to the String Reverser programming challenge. */ public class StringReverser { public static void main(String[] args) { String str = "Good Morning Java!"; strReverse(); } /** The strReverse method uses recursion to display a string backward. @param str The string to display backward. */ public static void strReverse(String str) { if (str.length() == 0) // Reached the end of the string { return; } else { System.out.print(str.charAt(str.length()-1)); } } } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!