Thread example and dfiffereance between run and start
public class thread_1 extends Thread {
//class TestSleepMethod1 extends Thread{
public void run(){
for(int i=1;i<5;i++){
/* try{
Thread.sleep(1000);
}
catch(InterruptedException e)
{
System.out.println(e);
}*/
System.out.println("Number is "+ i);
}
}
public static void main(String args[]){
thread_1 t1=new thread_1();
thread_1 t2=new thread_1();
t1.start();
t2.start();
// t1.run();
// t2.run();
}
}