Denis_Hristov

reverseArray

Feb 13th, 2021 (edited)
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. import java.util.Arrays;
  2. import java.util.Scanner;
  3.  
  4. public class zadacha {
  5.  
  6.     public static void printArrays(String [] splitInput){
  7.  
  8.         for (int i = splitInput.length - 1; i >=  0; i--) {
  9.             System.out.print(splitInput[i] + " ");
  10.         }
  11.     }
  12.     public static void main(String[] args) {
  13.         Scanner scan = new Scanner(System.in);
  14.         String input = scan.nextLine();
  15.  
  16.         String [] splitInput = input.split(" ");
  17.         System.out.println(Arrays.toString(splitInput));
  18.  
  19.         printArrays(splitInput);
  20.     }
  21. }
  22.  
Add Comment
Please, Sign In to add comment