Given the following code:
import javax.swing.*; import java.awt.*; public class NewClass extends JPanel { public void paintComponent(Graphics g) { g.drawLine(0, 0, 90, 90); } public static void main(String[] args) { JFrame jf = new JFrame(); jf.add(new NewClass()); jf.setSize(500, 500); jf.setVisible(true); } }
Why does he draw a line if the drawLine method is abstract and, as I understand, the abstract method has no definition?
Thank you in advance!
source share