Java Exception java.lang.IllegalThreadStateException
In Java, I am getting this exception:
Exception in thread "main" java.lang.IllegalThreadStateException
at java.lang.Thread.start(Unknown Source)
at Threads4.go(Threads4.java:14)
at Threads4.main(Threads4.java:4)
Here is the code:
public class Threads4 {
public static void main(String[] args){
new Threads4().go();
}
void go(){
Runnable r = new Runnable(){
public void run(){
System.out.println("foo");
}
};
Thread t = new Thread(r);
t.start();
t.start();
}
}
What does this exception mean?
+3
source to share
6 answers