Completing code to print an integer array

Report a typo

In a Java program, you're given an integer array that you need to print to the console. However, the method which is responsible for printing the array and the main method where this is called are missing some parts. The integer array is defined in the main method and called 'numbers'. Your task is to fill the blanks in code to accomplish that.

Fill in the gaps with the relevant elements
public class Main {
     main(String[] args) {
        int[] numbers = {1, 2, 3, 4, 5};
        printArray(numbers);
    }
    
    public static void printArray(int[] array) {
         (int num : array) {
            ("Number: " + num);
        }
    }
}
forSystem.out.printlnpublic static void
___

Create a free account to access the full topic