hi! Rahul, this is a really nice thing you do.... I think it really helps beginners like me...Thanks a lot... About the code, Well, the class demo1 doesnt implement the Runnable interface, and the argument passed to the constructor new Thread(p) must be an object that implements Runnable.The compiler will point out that.(but I am not sure what exactly the error message will be..) Or, the class demo1 should extend the Thread class so the method run() is available to it by inheritance... Could you let me know what the error message will be? thanks again... Vidya.
Joined: Jul 28, 2000
I made this post to make the point that implementing all the methods in the interface does not mean implementing the interface. In the code implementing the run method does not mean that one implements the Runnable interface. thus Code 1:
is not the same as Code 2:
Also the thread constructor not only takes a Runnable interface as a prarameter but can also take a Thread object as a parameter . for example
this is possible as the thread class itself is defined as public class Thread extends Object implements Runnable and since Thread class itself implements Runnable it can be passed as a parameter to the Thread constructor. Vidhya, Thanks for the complements. Complements really motivate.
Regds. Rahul P. Mahindrakar
[This message has been edited by Rahul Mahindrakar (edited August 21, 2000).]