+ 3
How can we prioritize the thread properly in java ??
2 Respuestas
+ 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)