Co treba takhle:
public class MyRunnable implements Runnable
{
/**
* run
*/
public void run() {
System.out.println(Thread. currentThread() .getName());
}
}
dany runnable pak spustis a pojmenujes nasledovne:
Thread thr1 = new Thread(new MyRunnbable(), "Thread name");
thr1.start();