nerdexam
Oracle

1Z0-851 · Question #56

Given: public class Threads2 implements Runnable { public void run() { System.out.println("run."); throw new RuntimeException("Problem"); } public static void main(String[] args) { Thread t = new…

The correct answer is D. End of method. run. java.lang.RuntimeException: Problem E. run. java.lang.RuntimeException: Problem End of method. Exception in thread "Thread-0" java.lang.RuntimeException: Problem at Threads2.run(Threads2.java:5) at java.lang.Thread.run(Unknown Source)

Managing System Processes and Scheduling Tasks

Question

Given: public class Threads2 implements Runnable { public void run() { System.out.println("run."); throw new RuntimeException("Problem"); } public static void main(String[] args) { Thread t = new Thread(new Threads2()); t.start(); System.out.println("End of method."); } } Which two can be results? (Choose two.)

Options

  • Ajava.lang.RuntimeException: Problem
  • Brun. java.lang.RuntimeException: Problem
  • CEnd of method. java.lang.RuntimeException: Problem
  • DEnd of method. run. java.lang.RuntimeException: Problem
  • Erun. java.lang.RuntimeException: Problem End of method.

How the community answered

(46 responses)
  • A
    4% (2)
  • B
    2% (1)
  • C
    9% (4)
  • D
    85% (39)

Explanation

Exception in thread "Thread-0" java.lang.RuntimeException: Problem at Threads2.run(Threads2.java:5) at java.lang.Thread.run(Unknown Source)

Topics

#Java threads#Runnable#thread scheduling#RuntimeException

Community Discussion

No community discussion yet for this question.

Full 1Z0-851 Practice