title: Printing an array on a certain line
body: <p>I need help printing the array, I need to print 6 items per line and switch to a next line for the seventh and following numbers. Also who do i Enter numbers into an array without defining how many numbers will be entered?</p>
  
  <pre><code>import java.util.Scanner;
  
  public class NumberArray
  {
      public static void main(String[] args) 
      {
          Scanner input = new Scanner(System.in);
          System.out.println("How many grades do you want to enter?");
          int num = input.nextInt();
          int array[] = new int[num];
          System.out.println("Enter the " + num + " grades now.");
          for (int grades = 0 ; grades &lt; array.length; grades++ ) 
          {
              array[grades] = input.nextInt();
          }
          System.out.println("These are the grades you have entered.");
          printArray(array);
      }
  
      public static void printArray(int arr[])
      {
          int n = arr.length;
          for (int i = 0; i &lt; n; i++) {
              System.out.print(arr[i] + " \t");
          }
      }
  }
  </code></pre>