Possible Duplicate:
java thread - run() and start() methods
I made a program which uses threading---
public class ThreadTest{
public static void main(String[] args){
MyThread newthread=new MyThread();
Thread t=new Thread(newthread);
t.start();
for(int x=0;x<10; x++){
System.out.println("Main"+x)
}
}
}
class MyThread implements Runnable{
public void run(){
for(int x=0; x<10; x++){
System.out.println("Thread"+x);
}
}
}
Now my question is that ... why do we use the "Thread" class and create it's object and pass the "MyThread" calls in it's constructor? can't we call the run method of the "MyThread" object by creating it's object and calling the run method?
( i.e MyThread newthread=new MyThread(); and then newthread.run();
)
What's the reason for creating tread objects and passing the MyThread class in it?