ASP ScriptingJava ScriptingCGI ScriptingHTMLJavaLanguage CERP Education Links

JAVA

Thread Priority

public class FiveTable extends Thread
{
public void run()
{
for(int i = 1; i <= 5; i++) 
System.out.println(i + " Fives are"  + (i* 5)); 
}

public class SevenTable extends Thread
{
public void run ( )
{
for(int i = 1; i <= 5; i++)
{
System.out.println(i + " Sevens are " + (i * 7)); 
public class ThirteenTable extends Thread
{
public void run ( ) 
{
for(int i = 1; i <= 5; i++)
System.out.println(i + " Thirteens are " + (i * 13));
}
}

public class PriorityDemo
{
public static void main(String arg[])
{
FiveTable five; 
SevenTable seven; 
ThirteenTable thirteen; 
five = new FiveTable(); 
seven = new SevenTable(); 
thirteen = new ThirteenTable();
five.setPriority(1); 
seven.setPriority(6); 
thirteen.setPriority(9);
five.start(); 
seven.start(); 
thirteen.start();
}
}

Output : This code will display Priority regarding threads.


Your Ad Here
Not All Of Your Subscribers Use RSS - AWeber Email Marketing
Your Ad Here