Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package O3Arrays;
- import java.util.Scanner;
- public class Ex04ReverseArrayOfStrings {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String input = scanner.nextLine();
- String[] splitInput = input.split(" ");
- String[] stringInput = new String[splitInput.length];
- for (int i = 0; i < splitInput.length; i++) {
- stringInput[splitInput.length - i -1] = splitInput[i];
- }
- for (int i = 0; i < splitInput.length; i++) {
- System.out.print(stringInput[i] + " ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment