/*
   An example of nested loops.

   Here is a refactored version of CheckerBoard3.java that
   is much simpler. In fact, if you compare this program
   to the first version, CheckerBoard.java, you can see
   that this program makes only one small change.
*/

public class CheckerBoard4
{
   public static void main( String[] args )
   {
      final int NUMBER_OF_COLUMNS = 16;
      final int NUMBER_OF_ROWS = 8;

      int columnCounter;
      int rowCounter;

      rowCounter = 0;
      while (rowCounter < NUMBER_OF_ROWS) // a counting loop
      {
         columnCounter = 0;
         while (columnCounter < NUMBER_OF_COLUMNS) // another counting loop
         {
            if (columnCounter % 2 == rowCounter % 2 )
               System.out.print("*");
            else
               System.out.print(" ");
            columnCounter++;
         }
         System.out.println(); // start a new line
         rowCounter++;
      }
   }//main()
}