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