Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Soft_Uni_Arrays {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- System.out.println("Array"); // enter Array.
- String [] family = sc.nextLine().split(" "); // read the array's symbols.
- for (int i = 0; i < family.length / 2; i++) { // perambulate all symbols of the array divided by 2 because we work with pairs.
- String temporaryFamily = family[i];// create new temp string to store the interchanges.
- family[i] = family[family.length -i -1]; //read the Array family reversely.
- family[family.length -i -1] = temporaryFamily; // abstract the reversely read temporary array to original one.
- }
- System.out.println(String.join(", ", family));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement