It is necessary to output the words written into an array of 7 objects separated by spaces.
Interested in how to make this code shorter:

System.out.println(masyv[0] + " " + masyv[1] + " " + masyv[2] + " " + masyv[3] +" " + masyv[4] + " " + masyv[5] + " " + masyv[6]); 

    2 answers 2

    If masyv is a String[] , then you can use the String.join method from Java 8:

     String[] masyv = { "a1", "b2", "c3", "d4", "e5", "f6", "g7" }; System.out.println(String.join(" ", masyv)); 

    And an array is still an array , not masyv .

      Can cycle

       for (Class clazz: masyv) System.out.print(clazz+" "); 
      • Can I describe this method in more detail? - yamaha373
      • @ yamaha373 What specifically is not clear to you? - JVic