public class Demo {
public static void main(String[] args) throws Exception {
new Thread(new ThreadDemo()).start();
new Thread(new ThreadDemo()).start();
}
}
class ThreadDemo implements Runnable{
public void run(){
for(int i = 0; i < 10; i++){
System.out.println(Thread.currentThread().getName()+" :"+i);
}
}
}