public class Demo_Thread10
{ public static void main(String[] args) throws InterruptedException {
//long start=System.currentTimeMillis();
MyRunnable mr=new MyRunnable();
for(int i=0;i<10;i++)
{
new Thread(mr,"Thread-"+i).start();
}
//long end=System.currentTimeMillis();
}
}
class MyRunnable implements Runnable
{
int sum=0;
public synchronized void run()
{
int i=Integer.parseInt(Thread.currentThread().getName().replaceAll("Thread-",""));
for(int count=0;count<11;count++)
{
sum+=(i*10)+count;