source code : fillShapes.java

import java.awt.*;

class fillShapes extends Frame

{

public void paint(Graphics g)

{

g.setColor(Color.blue);

g.fillRect(80,120,50,50);

g.setColor(Color.pink);

g.fillRect(150,150,50,150);

g.setColor(Color.red);

g.fillOval(200,50,50,50);

g.setColor(Color.green);

g.fillOval(225,200,100,50);

}

public static void main(String as[])

{

//drawShapes f=new drawShapes();

fillShapes f=new fillShapes();

f.setSize(300,300);

f.setVisible(true);

}

}

output: