How will u set priorities of threads?

This question is related to Oracle Interview

Showing Answers 1 - 1 of 1 Answers

Smitha Thomas

  • Apr 18th, 2006
 

Java priorities are in the range Thread.MIN_PRIORITY ( 1 ) to Thread.MAX_PRIORITY ( 10 ). The bigger the number, the better the access to the CPU a thread has. Thread.NORM_PRIORITY ( 5 ) is the default. // Bump up a thread's priority to the cpu one notch above the usual.thread.setPriority( Thread.NORM_PRIORITY + 1 );// Drop up the thread's priority two notches below where it is now.thread.setPriority( thread.getPriority() - 2 );

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions