Write the definition of a method printArray, which has one parameter, an array of int s. The method does not return a value. The method prints out each element of the array, on a line by itself, in the order the elements appear in the array, and does not print anything else.

LANGUAGE: JAVA

CHALLENGE:

Write the definition of a method printArray, which has one parameter, an array of int s. The method does not return a value. The method prints out each element of the array, on a line by itself, in the order the elements appear in the array, and does not print anything else.

SOLUTION:

void printArray(int a[]) {
   int i;
   for (i = 0; i < a.length; i++){
      System.out.print(a[i]);
      System.out.println();
   }
}