下面是一组上产上述错误原因的代码
public class Test1 {
public static void main(String[] args) {
Thread thread = new Demo();
thread.start();
thread.start();//这里删掉就不会报IllegalThreadStateException异常
}
}
class Demo extends Thread{
int x = 0;
@Override
public void run() {
while(true){
if(x>100){
System.out.println(x++);
}
}
}
}
java.lang.IllegalThreadStateException
原文:http://blog.51cto.com/13579086/2067261