×

Loading...

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

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?
Report