Draw Circles and Ellipses in Java Applet

In Java, the Graphics class doesn’t have any method for circles or ellipses. However, the drawOval() method can be used to draw a circle or an ellipse. Ovals are just like a rectangle with overly rounded corners.
The drawOval() method takes four arguments: the first two represent the top-left corner of the imaginary rectangle and the other two represent the width and height of the oval itself.

Note: If the width and height are the same, the oval becomes a circle. The oval’s coordinates are the coordinates of an enclosing rectangle.

Example:

import java.awt.*;
import java.applet.*;
public class circle extends Applet
{
 public void paint(Graphics g)
{
 g.drawOval(20,20,200,120);
 g.setColor(Color.green);
 g.fillOval(70,30,100,100);
}
}

<html>
   <head>
   </head>
   <body>
         <applet code = "circle.class" width = "480" height = "360"></applet>
   </body>
</html>

Output:
Draw Circles and Ellipses  in Java Applet