StefanTobler

Lesson 33 Activity 3

Dec 3rd, 2016
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. /*
  2.  * Lesson 33 Coding Activity 3
  3.  *
  4. Write a method that takes an array of ints and prints the array on a single line. Print one space between each number.
  5.  
  6. This method must be called printit() and it must take an int[] parameter.
  7.  *
  8.  */
  9.  
  10.  
  11. import java.util.Scanner;
  12.  
  13. class Lesson_33_Activity_Three {
  14.  
  15.     public static void printit(int x[])
  16.     {
  17.       for (int i = 0; i < x.length; i++)
  18.       {
  19.         System.out.println(x[i] + " ");
  20.       }
  21.     }
  22.  
  23.     public static void main(String[] args)
  24.      {
  25.       int x[] = {5,4,6,3,8,9,8,4};
  26.      printit(x);
  27.     }
  28. }
Add Comment
Please, Sign In to add comment