The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
January 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


abstract class Graphics

Posted by HRUDANANDA on January 03, 2001 at 1:00 AM

While we are overriding the paint(Graphics g) method for creating an Applet, we generally pass object of Graphics class as the argument. But Graphics is an Abstract class, still we can call the methods defined in Graphics class through the object reference of Graphics.

drawString method is defined in the Graphics class as follows:-

public abstract void drawString(String s, int i, int j);

But we can access the above method like the following way within paint method


How this is possible?


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us