×

Loading...

hi,jabber.I have a question about abstract class of java?

oldsix (oldsix)
in java, the abstract class can not new an object.So can i use the abstract method in the abstract class?which way?
the next code is run well,why?

eg. Toolkit ttkk=Toolkit.getDefaultToolkit();
Image img1=ttkk.getImage("abc.gif");

in this code, getImage() is the abstract method. It seems that you can use the abstract method directly. other more, what is the role of the ttkk? certainly,it isn't the object.
in documents of java, it seems the object of the subclass of Toolkit. is it right?

above all.there are two way to explain the code:
1. you can use the abstract method of abstract class.
2.from the static method getDefaultToolkit, you got the subobject of the Toolkit?
jabber,which one is right?
(#8383@0)
2000-9-11 -04:00
This post has been archived. It cannot be replied.
Page address has been copied.
To share, click to copy page address.
Share Online by QR Code

Back To Topic: hi,jabber.I have a question about abstract class of java?

Back To Forum: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论