Hi Srikant,
First of all you can not have more than one run() method. You can have overloaded run methods but they are not part of Thread class. For e.g :
public class Demo extends Thread{
public static void main(
String a[]){
Demo d1=new Demo();
Demo d2=new Demo();
Demo d3=new Demo();
d1.start();
d2.start(10); //error
d3.start(10,20); //error
}
public void run(){
System.out.println(Thread.currentThread().getName()+" started");
}
public void run(int x){
System.out.println(Thread.currentThread().getName()+" started");
}
public void run(int x,int x){
System.out.println(Thread.currentThread().getName()+" started");
}
}
this will throw compilation error(at the highlighted lines).
If you want some part of your code be thread protected(i.e only one thread can access that at a time), then better put that in run method or you can also put it in a synchronized method. If a method is declared as synchronized then only one thread can access it at a time.