public class MyRunnable implements Runnable { int a=0; public void run(){ for(a=0;a<10;a++){ try{Thread.sleep(100);}catch(Exception e){} System.out.println(Thread.currentThread().getName()+":"+a); } } public static void main(String[] args) { MyRunnable mr=new MyRunnable(); Thread t1=new Thread(mr); Thread t2=new Thread(mr); t1.start(); t2.start(); } }