-
-
Save deepakkhattar26o2/36909b9668ed5f75135220eeea8ce266 to your computer and use it in GitHub Desktop.
LHD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class reverseString { | |
public static void main(String[] args){ | |
Scanner scan = new Scanner(System.in); | |
System.out.println("Enter a String to be Reversed: "); | |
String oldString = scan.nextLine(); | |
String newString = ""; | |
for(int i= oldString.length()-1; i>=0;i--){ | |
newString+=oldString.charAt(i); | |
} | |
System.out.println("New String: "+newString); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment