title: Creating a checkerboard in Java using a while loop
body: <p>The goal is to create an ASCII checkerboard using the following pattern:</p>
  
  <pre><code>+--+
  |  |
  +--+
  </code></pre>
  
  <p>I have used the following code in Java to create a board with n boxes but the problem is that the resulting boxes stack vertically like a line when I pass n argument:</p>
  
  <pre><code>+--+
  |  |
  +--+
  +--+
  |  |
  +--+
  </code></pre>
  
  <p>I want the boxes to iterate across lines so it forms a checkerboard like pattern like 
  this:</p>
  
  <pre><code>+--+--+
  |  |  |
  +--+--+
  |  |  |
  +--+--+
  </code></pre>
  
  <p>The Java code is:</p>
  
  <pre><code>public class Checkerboard {
  public static void main(String[] args) {
      int x = Integer.parseInt(args[0]);
      printBoard(x);
  }
  
  
  public static void printBox(int numOfBoxes) {
  
      int i = 0;
      while(i &lt; numOfBoxes)
      i++;    
       System.out.print("+--+");
       System.out.println("|  |");
       System.out.println("+--+");
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Any input would be greatly appreciated. Thanks in advance! </p>