public class Test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int i=0;i<10;i++){
MyThread myThread=new MyThread();
myThread.start();
try {
myThread.sleep(1);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
class MyThread extends Thread{
@Override
public synchronized void run()
{
// TODO Auto-generated method stub
for(int i=0;i<100;i++)
{
System.out.println(i);
}
}
}