We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 872522d + cf83ea1 commit 36f084dCopy full SHA for 36f084d
Java/Reverse.java
@@ -0,0 +1,15 @@
1
+public class Reverse {
2
+
3
+ public static void main(String[] args) {
4
+ String sentence = "Go work";
5
+ String reversed = reverse(sentence);
6
+ System.out.println("The reversed sentence is: " + reversed);
7
+ }
8
9
+ public static String reverse(String sentence) {
10
+ if (sentence.isEmpty())
11
+ return sentence;
12
13
+ return reverse(sentence.substring(1)) + sentence.charAt(0);
14
15
+}
0 commit comments