nerdexam
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)
  • A
    4% (1)
  • B
    7% (2)
  • C
    4% (1)
  • D
    15% (4)
  • E
    70% (19)

Community Discussion

No community discussion yet for this question.

Full 1Z0-851 Practice