This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
We say abstract class object can't be created.Then how Abstract class Graphics referance is passed in the method paint(Graphics g).When mehod inside abstract class like drawLine is also abstract then where it is defined? Also plz tell me how the paint method is invoked automatically?
I'll tell you about paint() When you change a drawing in an applet, you call the repaint() method to repaint the applet surface. The repaint() method calls the update() method. The update() method clears the viewing area and calls the paint() method, which contains the drawing instructions. I hope this is helpful Regards, Usman
Utkarsh, What happens is behind the scenes repaint() creates a class that extends graphics and upcasts it to a Grahics reference. It then calls update, passing it this object as a parameter. You will find this behavior throughout the API.