标签:
public static void main(String[] args) { Model model = new Model(); model.start(); model.start(); } class Model extends Thread{ int num = 20; @Override public void run() { // TODO Auto-generated method stub while(num>0){ System.out.println(Thread.currentThread().getName()+" "+num); num--; } } }
运行结果
Exception in thread "main" java.lang.IllegalThreadStateException
at java.lang.Thread.start(Unknown Source)
at TeachMultiThread.teach1.main(teach1.java:7)
Thread-0 20
Thread-0 19
Thread-0 18
Thread-0 17
Thread-0 16
Thread-0 15
Thread-0 14
Thread-0 13
Thread-0 12
Thread-0 11
Thread-0 10
Thread-0 9
Thread-0 8
Thread-0 7
Thread-0 6
Thread-0 5
Thread-0 4
Thread-0 3
Thread-0 2
Thread-0 1
带你玩转java多线程系列 一 java.lang.IllegalThreadStateException异常
标签:
原文地址:http://www.cnblogs.com/winAlaugh/p/5473407.html