package multithreading;
public class Adv_Thread1 {
public static void main(String[] args)
{
ThreadGroup g1 = new ThreadGroup("First Group");
System.out.println(g1.getParent().getName());
ThreadGroup g2 = new ThreadGroup(g1,"Second group ");
System.out.println(g2.getParent().getName());
ThreadGroup g3 = new ThreadGroup(g1,"Third Group");
System.out.println(g3.getParent().getName());
Thread t1 = new Thread(g1, "thread_01");
Thread t2 = new Thread(g1, "thread_02");
Thread t3 = new Thread(g1, "thread_03");
Thread t4 = new Thread(g2, "thread_04");
g1.setMaxPriority(3);
Thread t5 = new Thread(g1, "thread_05");
Thread t6 = new Thread(g1, "thread_06");
System.out.println(t1.getPriority());
System.out.println(t2.getPriority());
System.out.println(t3.getPriority());
System.out.println(t4.getPriority());
System.out.println(t5.getPriority());
System.out.println(t6.getPriorit:y());
}
}
public class Adv_Thread1 {
public static void main(String[] args)
{
ThreadGroup g1 = new ThreadGroup("First Group");
System.out.println(g1.getParent().getName());
ThreadGroup g2 = new ThreadGroup(g1,"Second group ");
System.out.println(g2.getParent().getName());
ThreadGroup g3 = new ThreadGroup(g1,"Third Group");
System.out.println(g3.getParent().getName());
Thread t1 = new Thread(g1, "thread_01");
Thread t2 = new Thread(g1, "thread_02");
Thread t3 = new Thread(g1, "thread_03");
Thread t4 = new Thread(g2, "thread_04");
g1.setMaxPriority(3);
Thread t5 = new Thread(g1, "thread_05");
Thread t6 = new Thread(g1, "thread_06");
System.out.println(t1.getPriority());
System.out.println(t2.getPriority());
System.out.println(t3.getPriority());
System.out.println(t4.getPriority());
System.out.println(t5.getPriority());
System.out.println(t6.getPriorit:y());
}
}
--------------------------------------------------------------------------
output:
main
First Group
First Group
5
5
5
5
3
3
No comments:
Post a Comment