Write a Java program to implement checkered output.

import java.awt.*;
import java.applet.*;
/*
<applet code="Exp10_2" width="200" height="300">
</applet>
*/
public class Exp10_2 extends Applet
{
 public void paint(Graphics g)
 {
  int x, y;
  for (int row = 0; row < 8; row++) 
  {
   for (int col = 0; col < 8; col++) 
   {
    x = 20*col;
    y = 20*row;
    if ((row % 2) == (col % 2))
     g.setColor(Color.white);
    else
     g.setColor(Color.black);
    g.fillRect(x,y,20,20);
   }
  }
 }
}

/*  OUTPUT!!!



Copyright © LetML. Blogger Templates Designed by OddThemes