0
Help me rectify the error
import java.util.Scanner; public class ReversingAnInteger { public static void main (String args[]) { Scanner input = new Scanner (System.in); { System.out.print("enter a string:"); { char [] letters = input.nextLine.to CharArray(); { System.out.println("reverse string:"); { for (int i = letters.length - 1;i>=0;i--) { System.out.print(letters[i]); { System.out.print("\n"); } } } } } } } }
1 Réponse
+ 1
import java.util.Scanner;
public class ReversingAnInteger{
public static void main (String args[]){
Scanner input = new Scanner (System.in);
System.out.print("enter a string:");
char[] letters = input.nextLine().toCharArray();
System.out.println("reverse string:");
for (int i = letters.length - 1;i>=0;i--){
System.out.print(letters[i]);
System.out.print("\n");
}
}
}