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

Pubblicato il: 22 ottobre 2023
sul canale di: 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


In questa pagina del sito puoi guardare il video online Multithreading Methods In Java | getPriority | setPriority | getId | currrentThread @Technical Icode della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Technical Icode 22 ottobre 2023, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 44 volte e gli è piaciuto 2 spettatori. Buona visione!