+ 3

How can we prioritize the thread properly in java ??

4th May 2018, 5:43 AM
Mohit Aggarwal
Mohit Aggarwal - avatar
1 Odpowiedź
+ 1
You can set priorities to threads before starting them using setPriority() which takes a constant between 1 and 10 Or simply MIN_PRIORITY for 1 NORM_PRIORITY for 5 (this is default) MAX_PRIORITY for 10 for example: thread t1 can be given maximum priority by t1.setPriority(MAX_PRIORITY) or t1.setPriority(10)
4th May 2018, 9:00 AM
Uday
Uday - avatar