/* A simple checker board applet not using for statements, or increment operators */ import java.applet.*; import java.awt.*; public class checkers2 extends Applet { public void paint( Graphics g ) { int size = 8, squareSize = 40, x = 10, y = 10, row, col; // paint board black g.fillRect(x, y, size*squareSize, size*squareSize); // paint red squares g.setColor(Color.red); row = 0; while ( row < size ) { // paint a row of red squares col = 0; while ( col < size) { g.fillRect(x + (row % 2 + col)*squareSize, y + row*squareSize, squareSize, squareSize); col = col + 2; } row = row + 1; } } }