- 2
How to reverse a string in java ?
2 Respostas
+ 2
Hope it helps.
https://www.simplilearn.com/tutorials/java-tutorial/reverse-a-string-in-java
Happy Coding 🤠
0
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String text = scanner.nextLine();
char[] arr = text.toCharArray();
String res ="";
for (int x=arr.length-1;x>=0;x--){
res+=arr[x];
}System.out.println(res);
}
}