The drawing functions of the Graphics class are all abstract methods, so why can you draw a graph by calling these functions?

package shapes;

import java.awt.Graphics;

public class Circle extends Shape {
    private int x;
    private int y;
    private int radius;
    
    public Circle(int x, int y, int radius)
    {
        this.x = x;
        this.y = y;
        this.radius = radius;
    }
    @Override
    public void draw(Graphics g) {
        g.drawOval(x-radius, y-radius, radius*2, radius*2);
    }
}

from the g.drawOval point, we find that it is an abstract method, and I don"t know where its implementation is. And the Graphics object as a parameter doesn"t know where it was generated.

Mar.07,2021
Menu