Given: t is a reference to a valid Thread object And the following valid run() method for t:
9. public void run() {
10. System.out.print("go ");
11. }
And:
18. t.start();
19. t.start();
20. t.run();
Which can be a result?
A go
B go go
C go go go
D go followed by an exception
E go go followed by an exception
F An exception is thrown with no other output.
como implementei está certo e porque deu esse erro ???
public class Q35 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Thread t = new Thread(new Thread());
t.start();
t.start();
t.run();
}
public void run() {
System.out.print("go ");
}
}
-----
Exception in thread "main" java.lang.IllegalThreadStateException
at java.lang.Thread.start(Unknown Source)
at br.com.Q35.main(Q35.java:13)