Advertisement
EChebanenko

Untitled

Aug 28th, 2020
1,421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 KB | None | 0 0
  1. package com.company;
  2.  
  3. public class Lesson5HM4_12 {
  4.     public static void main(String args[]) {
  5.         String[] a = {"Привет ", " меня ", " зовут ", " Макс"};
  6.         int n = a.length;
  7.         String text;
  8.  
  9.         for (int i = 0; i < n / 2; i++) {
  10.             text = a[n - i - 1];
  11.             a[n - i - 1] = a[i];
  12.             a[i] = text;
  13.         }
  14.         for (int i = 0; i < a.length; i++) {
  15.             System.out.print(a[i]);
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement