Biology Forums - Study Force

Science-Related Homework Help Computer Studies Topic started by: daniellasousa on May 5, 2020



Title: When you run the following program, what will happen?public class Test extends Thread { public ...
Post by: daniellasousa on May 5, 2020
When you run the following program, what will happen?

public class Test extends Thread {
public static void main(String[] args) {
Test t = new Test();
t.start();
t.start();
}

public void run() {
System.out.println("test");
}
}


▸ The program displays test twice.

▸ The program displays test once.

▸ Nothing is displayed.

▸ An illegal java.lang.IllegalThreadStateException may be thrown because you just started thread and thread might have not yet finished before you start it again.


Title: When you run the following program, what will happen?public class Test extends Thread { public ...
Post by: ShayT0923 on May 5, 2020
Content hidden