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"); } } } } } } } }

7th Sep 2019, 6:05 PM
Ankush Raj
Ankush Raj - avatar
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"); } } }
7th Sep 2019, 6:27 PM
Anton Böhler
Anton Böhler - avatar