Here's a question on a test that I got wrong, I'm confused by how setPriority(Thread.MIN_Priority) and setPriority(1) differ.
Q: Assume your multithreaded program has a background thread (called batchThread) which does some lengthy processing, what would be t开发者_JS百科he proper way of setting its priority to allow the rest of the system to be very responsive while batchThread is running?
a) batchThead.setPriority(1);
b) batchThead.setPriority(Thread.MAX_PRIORITY);
c) batchThead.setPriority(Thread.MIN_PRIORITY);
d) batchThead.setPriority(Thread.MID_PRIORITY);
I chose C and got it wrong. Appreciate the help as always.
I believe they're one in the same. According to the Java docs, Thread.MIN_PRIORITY is 1: http://download.oracle.com/javase/1.4.2/docs/api/constant-values.html#java.lang.Thread.MAX_PRIORITY
Perhaps your instructor was mistaken?
精彩评论