我正在制作一个程序,我需要一个线程停止,另一个线程启动。我的问题是,如果我 t1.stop() 比 t1.start() 我得到 java.lang.IllegalThreadStateException
if (t1.isAlive() == true){
t1.stop();
// above I stop the thread and call another
t2.start();
System.out.println("t1 was playing");
}else{
t2.stop();
t1.start();
// above I stop the other thread and want to start the first thread again, but when I run the program I get the exception i said above
}