Saturday, September 17, 2016

10. Write a JAVA program to print a chessboard pattern.

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

7 comments:

  1. I’ve desired to post about something similar to this on one of my blogs and this has given me an idea. Cool Mat.
    I’ve desired to post about something similar to this on one of my blogs and this has given me an idea. Cool Mat.

    ReplyDelete
  2. I appreciate that you produced this wonderful article to help us get more knowledge about this topic. I know, it is not an easy task to write such a big article in one day, I've tried that and I've failed. But, here you are, trying the big task and finishing it off and getting good comments and ratings. That is one hell of a job done!
    Data Science Training in Chennai
    Data Science course in anna nagar
    Data Science course in chennai
    Data science course in Bangalore
    Data Science course in marathahalli

    ReplyDelete
  3. Awesome article. It is so detailed and well formatted that i enjoyed reading it as well as get some new information too.
    Best Devops Training in pune
    Devops Training in Bangalore
    Microsoft azure training in Bangalore
    Power bi training in Chennai

    ReplyDelete
  4. After reading this web site I am very satisfied simply because this site is providing comprehensive knowledge for you to audience.
    Thank you to the perform as well as discuss anything incredibly important in my opinion. We loose time waiting for your next article writing in addition to I beg one to get back to pay a visit to our website in




    Selenium training in bangalore
    Selenium training in Chennai
    Selenium training in Bangalore
    Selenium training in Pune
    Selenium Online training

    ReplyDelete