nerdexam
Oracle

1Z0-851 · Question #128

Given: public class TestOne { public static void main (String[] args) throws Exception { Thread.sleep(3000); System.out.println("sleep"); } } What is the result?

The correct answer is C. The code executes normally and prints "sleep". See the full explanation below for the reasoning.

Question

Given: public class TestOne { public static void main (String[] args) throws Exception { Thread.sleep(3000); System.out.println("sleep"); } } What is the result?

Options

  • ACompilation fails.
  • BAn exception is thrown at runtime.
  • CThe code executes normally and prints "sleep".
  • DThe code executes normally, but nothing is printed.

How the community answered

(37 responses)
  • A
    8% (3)
  • B
    5% (2)
  • C
    84% (31)
  • D
    3% (1)

Community Discussion

No community discussion yet for this question.

Full 1Z0-851 Practice