Solution

//Purpose:  Draws Squares

import java.awt.Graphics;  //Graphics Classes
import java.applet.Applet; //Applet Class
import java.awt.Color; //Color Class


public class test5 extends Applet {

   public Color color1, color2, color3, background;


   public void init() {
     color1 = new Color(255,0,0);
     color2 = new Color(0,255,0);
     color3 = new Color(0,0,255);
     background = new Color(255,255,255);
   }


   public void paint(Graphics g) {
     g.setColor( background );
     g.fillRect(0,0,100,200);
     g.setColor( color1 );
     g.fillRect(0,0,100,100);
     g.setColor( color2 );
     g.fillRect(20,20,60,60);
     g.setColor( color3 );
     g.fillRect(40,40,20,20);
   }

}