Q:

How can i print all content of one Array in one line?

I'me new here and beginner of JAVA.
I've just started learning about Scanner and Array!
I want to get some input from Scanner. and save it into Array. 
the array size is 5 and I succeed save those 
but what I could print is only one value from array.
I want to print all values in the array
and I have no idea what should I do or where I should fix!
hope you guys tell me about that.
My code is down below. 
import java.util.Scanner;

import jdk.internal.util.xml.impl.Input;

public class Test2 {

    public static void main(String[] args) {
        int[] array = new int[5];

        Scanner scanner = new Scanner(System.in);
        System.out.print("five numbers");

        for (int i = 0; i <= array.length; i++) {
            array[i] = scanner.nextInt();
        }
        for (int nums : array) {
            System.out.print(nums);
        }

    }
}

this is result :
five numbers1 2 3 5 5 

A:

The issue is with the following iteration which is expecting 6 numbers (since i starts at 0 and ends at 5). 
This wont work :
for (int i = 0; i <= array.length; i++)

This will work
You should either input 6 numbers and change your array size to 6 elements. Either ways, you need to change the for loop to :
for (int i = 0; i < array.length; i++)

