class priority extends Thread
{
priority(String s)
{
super(s);
}
public void run()
{
System.out.println("Running Thread Name is : "+Thread.currentThread().getName());
System.out.println("Running Thread Priority is : "+Thread.currentThread().getPriority());
}
public static void main(String surat[])
{
priority p=new priority("Min");
priority r=new priority("Max");
p.setPriority(Thread.MIN_PRIORITY);
r.setPriority(Thread.MAX_PRIORITY);
p.start();
r.start();
}
}
Output:
{
priority(String s)
{
super(s);
}
public void run()
{
System.out.println("Running Thread Name is : "+Thread.currentThread().getName());
System.out.println("Running Thread Priority is : "+Thread.currentThread().getPriority());
}
public static void main(String surat[])
{
priority p=new priority("Min");
priority r=new priority("Max");
p.setPriority(Thread.MIN_PRIORITY);
r.setPriority(Thread.MAX_PRIORITY);
p.start();
r.start();
}
}
Output:
No comments:
Post a Comment