Oracle
1Z0-851 · Question #68
Given: public class Threads3 implements Runnable { public void run() { System.out.print("running"); } public static void main(String[] args) { Thread t = new Thread(new Threads3()); t.run()…
The correct answer is E. The code executes and prints "runningrunningrunning". See the full explanation below for the reasoning.
Question
Given: public class Threads3 implements Runnable { public void run() { System.out.print("running"); } public static void main(String[] args) { Thread t = new Thread(new Threads3()); t.run(); t.run(); t.start(); } } What is the result?
Options
- ACompilation fails.
- BAn exception is thrown at runtime.
- CThe code executes and prints "running".
- DThe code executes and prints "runningrunning".
- EThe code executes and prints "runningrunningrunning".
How the community answered
(27 responses)- A4% (1)
- B7% (2)
- C4% (1)
- D15% (4)
- E70% (19)
Community Discussion
No community discussion yet for this question.