source code:  drawShapes.java 

import java.awt.*;

class drawShapes extends Frame

{

public void paint(Graphics g)

{

g.drawLine(100,100,50,100);

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

g.drawRect(50,200,50,150);

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

g.drawOval(200,200,100,50);

}

public static void main(String as[])

{

drawShapes f=new drawShapes();

f.setSize(300,300);

f.setVisible(true);

}

}

output: