Skip to content

Commit

Permalink
Added ReverseString.java code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ankit180898 committed Oct 8, 2023
1 parent 9cfdfec commit 25be823
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ReverseString.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import java.io.*;
import java.util.*;
import java.util.Scanner;

class stringreverse {
public static void main(String[] args) {
String str = "Welcome To hacktober";
String[] strArray = str.split(" ");
for (String temp: strArray){
System.out.println(temp);
}
for(int i=0; i<3; i++){ char[] s1 = strArray[i].toCharArray(); for (int j = s1.length-1; j>=0; j--)
{System.out.print(s1[j]);}
System.out.print(" ");
}
}
}

0 comments on commit 25be823

Please sign in to comment.