Multithreading Methods In Java | getPriority | setPriority | getId | currrentThread @Technical Icode

Publié le: 22 octobre 2023
sur la chaîne: Technical Icode
44
2

Subscribe The Channle
‪@technicalicode‬



Thread Priority, Thread ID
setPriority()
getPriority()
getid()
currentThread()

class A extends Thread
{
public void run()
{
System.out.println("\n inside Thread A: \nTread ID:\t"+
Thread.currentThread().getid()+"\nThread
Priority:\t"+Thread.currentThread().getPriority());
}
}
class B extends Thread
{
public void run()
{
System.out.println("\n inside Thread B: \nTread ID:\t"+
Thread.currentThread().getid()+"\nThread
Priority:\t"+Thread.currentThread().getPriority());
}
}
class C extends Thread
{
public void run()
{
System.out.println("\n inside Thread C: \nTread ID:\t"+
Thread.currentThread().getid()+"\nThread
Priority:\t"+Thread.currentThread().getPriority());
}
}
class threadid
{
public static void main(String args[])
{
A aa=new A();
B bb=new B();
C cc=new C();
aa.setPriority(Thread.MIN_PRIORITY);
bb.setPriority(Thread.NORM_PRIORITY);
cc.setPriority(Thread.MAX_PRIORITY);

System.out.println("\n inside Main Thread and it's ID is:"
+Thread.currentThread().getid()+"\nMain
Priority="+Thread.currentThread().getPriority());
System.out.println("\n Now calling other threads:
Thread A -Thread B - Thread C");
aa.start();
bb.start();
cc.start();
}
}



#technicalicode
#multithreadingmethods
#getpriority
#setpriority
#multithreadinginjava
#multithreading
#multithread


Sur cette page du site, vous pouvez voir la vidéo en ligne Multithreading Methods In Java | getPriority | setPriority | getId | currrentThread @Technical Icode durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Technical Icode 22 octobre 2023, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 44 fois et il a aimé 2 téléspectateurs. Bon visionnage!