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)- A4% (2)
- B2% (1)
- C9% (4)
- D85% (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.