Question 222 / 297:  What is true?
public class Test implements Runnable {

public static void main(String[] args) {

Test test = new Test();

Thread thread = new Thread(test);

thread.start();

thread.join();

System.out.print("main");

}

public void run() {

System.out.print("run");

}

}

A  the program could prints runmain
B  the program could prints mainrun
C  the compilation fails
D  an exception is thrown at run time
<< First < Previous Next > Last >>
Explanation:

join throws a checked exception, needs to be handled by either a try/catch block or by declaring the exception in the main() header

Exam Home Page
Ask
Marion Cabalfin
Start Quiz
Danielle Stephens
Start Quiz
Copy and paste the following HTML code into your website or blog.
<iframe src="https://www.jobilize.com/embed/java-certification-questions" width="600" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" style="border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>