Solution

//Purpose:  Draws Squares

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


public class test3 extends Applet {

   public Color color1, color2, color3;
   public int Index=0;


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


   public void paint(Graphics g) {
     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);
   }

}