class myThread implements Runnable { public void run() { System.out.println("mythread"); } } ... myThread thread=new myThread();
Thread mythread=thread; mythread.start(); .....
public A extends Thread{ … public void run{ … sleep(); … } … } public A implement Runnable{ … public void run{ … Thread.currentThread().sleep(); … } … }
...
//your code
}
{}
public void run()
{
System.out.println("mythread");
}
}
... myThread thread=new myThread();
Thread mythread=thread;
mythread.start();
.....
…
public void run{
…
sleep();
…
}
…
}
public A implement Runnable{
…
public void run{
…
Thread.currentThread().sleep();
…
}
…
}