Question 171 / 297:  What is the possible output of compiling and running the following code?
Choose 2
public class Test {

public static void main(String[] args) {

Thread request1 = new Thread(new InternetRequest (),"request#1 ");

Thread request2 = new Thread(new InternetRequest (),"request#2 ");

request1.start();

request2.start();

}

}

class InternetRequest implements Runnable {

public void run() {

System.out.print(Thread.currentThread().getName());

}

}

<< First < Previous Next > Last >>
Explanation:

Although request1 is started before request2 that doesn't mean it will seize the CPU before request2. The order in which runnable threads are chosen to run is not guaranteed.

Exam Home Page
Ask
Courntey Hub
Start Test
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>