Understanding how drawLine works
问题 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 it draw a line if the method drawLine is abstract and, as I managed to understand, an abstract method has no definition? Thank you in advance! 回答1: paintComponent() gets a non