【发布时间】:2014-10-28 02:37:11
【问题描述】:
比如下面的代码为什么不输出优先级7?
public class Test {
public static void main(String[] args) {
Thread thread = new Thread(new A());
thread.setPriority(7);
System.out.println("in main: " + thread.getPriority());
thread.start();
}
}
class A extends Thread {
@Override
public void run() {
System.out.println("in thread: " + this.getPriority());
}
}
输出:
in main: 7
in thread: 5
【问题讨论】:
标签: java multithreading java-7 thread-priority