>

Wednesday, December 19, 2012

Thread Program in Java

What is out put?


public class Thread_Demo extends Thread{

public void run(){
System.out.println("Some text");
}

public static void main(String[] args) throws InterruptedException {


Thread_Demo td=new Thread_Demo();
Thread_Demo td1=new Thread_Demo();
/*Thread t=new Thread(td);*/
td.start();
td.setPriority(10);
System.out.println(td.getName()+td.getPriority());
td1.run();
System.out.println(td1.getName()+td1.getPriority());
}
}

No comments:

Post a Comment

Please post your comments. Your comments make us to write more programs for you.