public class InterruptedExceptionextends Exception Thrown when a thread is waiting, sleeping, or otherwise paused for a long time and another thread interrupts it using the interrupt method in class Thread.start()也会导致异常!上面的有些家伙人云亦云!白痴行为! start public native synchronized void start() Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread. The result is that two threads are running concurrently: the current thread (which returns from the call to the start method) and the other thread (which executes its run method). Throws:IllegalThreadStateException - if the thread was already started.
mt2.start();
我在中间加上mt1.sleep(1000);就没有报错
清楚了吗?
start public native synchronized void start() Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread. The result is that two threads are running concurrently: the current thread (which returns from the call to the start method) and the other thread (which executes its run method).
Throws:IllegalThreadStateException - if the thread was already started.