帮忙看看线程为什么这段代码出错了? t1.setPriority(Thread.NORM_PRIORITY) 是设置优先级的。你看一下hread.NORM_PRIORITY定义.public final static int NORM_PRIORITY = 5; 是final的不能改变其值。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 setPrioritypublic final void setPriority(int newPriority)更改线程的优先级。 首先调用线程的 checkAccess 方法,且不带任何参数。这可能抛出 SecurityException。 在其他情况下,线程优先级被设定为指定的 newPriority 和该线程的线程组的最大允许优先级相比较小的一个。 参数:newPriority - 要为线程设定的优先级 抛出: IllegalArgumentException - 如果优先级不在 MIN_PRIORITY 到 MAX_PRIORITY 范围内。 SecurityException - 如果当前线程无法修改该线程。另请参见:getPriority(), checkAccess(), getThreadGroup(), MAX_PRIORITY, MIN_PRIORITY, ThreadGroup.getMaxPriority()可以 t1.setPriority(3); 或给其他int 值 /** * The default priority that is assigned to a thread. */ public final static int NORM_PRIORITY = 5; Thread.NORM_PRIORITY一般指主线程的优先级 I/O流编码问题 本人,新手,关于swing的一个问题,求解! java中如何添加org.apache.batik这个包(在线等待 急 速度) spring中事务管理的问题 我写了个杨辉三角的程序,出现数组溢出.. java中有无方便的类来取得两个字符串相同的子串 请教linkedlist源代码,有点没明白什么意思。 sun j2sdkee1.3.1 启动不起来,WHY ?在线等待 一个数据结构有关的难题,爱好者高手请进! 求助一个简单的线程问题 [急!]怎么在不用Map所有类的情况下,实现一个和Map类有相同功能和特性的类 回文数猜想
setPriority
public final void setPriority(int newPriority)更改线程的优先级。
首先调用线程的 checkAccess 方法,且不带任何参数。这可能抛出 SecurityException。 在其他情况下,线程优先级被设定为指定的 newPriority 和该线程的线程组的最大允许优先级相比较小的一个。
参数:
newPriority - 要为线程设定的优先级
抛出:
IllegalArgumentException - 如果优先级不在 MIN_PRIORITY 到 MAX_PRIORITY 范围内。
SecurityException - 如果当前线程无法修改该线程。
另请参见:
getPriority(), checkAccess(), getThreadGroup(), MAX_PRIORITY, MIN_PRIORITY, ThreadGroup.getMaxPriority()
可以 t1.setPriority(3); 或给其他int 值
* The default priority that is assigned to a thread.
*/
public final static int NORM_PRIORITY = 5;