i have heard ,if we use static key word for any method or variable ,we have to call the method using the classname like,ClassName.variableName
But in the below program the static method sleep of thread called without class name.How it is possible?
Since you extend Thread class all the public methods of thread class becomes the part
of the extended class. As you know to call local method of the class can be just called with their name
we call sleep methods. For more information please see
in java there is a concept called "static import " if you was imported like static import then there is no need of class name to call any function . you can dirlty called any method which is static.
Yes, I do believe lambadi is right. Static methods are not inherited, so a subclass of Thread shouldn't be able to call it from the this reference. This should be an omitted static import.