填空题 请在下面横线处填入适当的代码,将线程对象runner[2]的优先级设置为最高。 class ThreadTest extends Thread public static void main(String args[]) { ThreadTest[] runner = new ThreadTest[4]; for(int j = 0; j<4; j++) runner[j] = new ThreadTest(); for(int j = 0; j<4; j++) runner[j].start(); {{U}} 【7】 {{/U}} runner[3].setPriority(MIN_PRIORITY); } public void run{) { for(int i = 0; i<100000; i++); System.out.println(getName() + "线程的优先级是:" + getPriority() + "计算完毕");
  • 1、
【正确答案】 1、nmner[2lsetPriority(MAX_PRIORITY);    
【答案解析】[解析] 程序中定义了一个ThreadTest类,在此类中声明四个线程对象runner[1]、runner[2]、 runner[3]和runner[4],并对这四个线程进行初始化和启动,然后将runner[2]的优先级设置为最高,runner[3]的优先级设置为最低。线程对象runner[1]和runner[4]的优先级未进行设置,故采用默认优先级。在run()方法输出线程运行信息和优先级。