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

Published: 22 October 2023
on channel: 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


On this page of the site you can watch the video online Multithreading Methods In Java | getPriority | setPriority | getId | currrentThread @Technical Icode with a duration of hours minute second in good quality, which was uploaded by the user Technical Icode 22 October 2023, share the link with friends and acquaintances, this video has already been watched 44 times on youtube and it was liked by 2 viewers. Enjoy your viewing!