Oracle
1Z0-851 · Question #244
1Z0-851 Question #244: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-851 to reveal the answer and full explanation for question #244. The question stem and answer options stay visible for context.
Question
Given that Triangle implements Runnable, and: void go() throws Exception { Thread t = new Thread(new Triangle()); t.start(); for(int x = 1; x < 100000; x++) { //insert code here if(x%100 == 0) System.out.print("g"); } } public void run() { try { for(int x = 1; x < 100000; x++) { // insert the same code here if(x%100 == 0) System.out.print("t"); } } catch (Exception e) { } } Which two statements, inserted independently at both lines 35 and 41, tend to allow both threads to temporarily pause and allow the other thread to execute? (Choose two.)
Options
- AThread.wait();
- BThread.join();
- CThread.yield();
- DThread.sleep(1);
- EThread.notify();
Unlock 1Z0-851 to see the answer
You've previewed enough free 1Z0-851 questions. Unlock 1Z0-851 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.