/*
   An example of nested loops.

   This version prints out a "checkerboard" pattern, but the even
   and odd rows do not have the same length, which is not so good
   (change the space to some other character to see this).
*/

public class CheckerBoard2
{
   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;
         if (rowCounter % 2 == 1)
            System.out.print(" "); // a leading space in odd rows
         while (columnCounter < NUMBER_OF_COLUMNS) // a counting loop
         {
            if (columnCounter % 2 == 0 )
               System.out.print("*");
            else
               System.out.print(" ");
            columnCounter++;
         }
         System.out.println(); // start a new line
         rowCounter++;
      }
   }//main()
}