What is the answer and how the program work?

Ads
 

What is the answer and how the program work?

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.) A. java.lang.RuntimeException: Problem B. run. java.lang.RuntimeException: Problem C. End of method. java.lang.RuntimeException: Problem D. End of method. run. java.lang.RuntimeException: Problem E. run. java.lang.RuntimeException: Problem End of method.

View Answers

July 14, 2012 at 10:31 PM

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package com.kota.core;

public class Exp1 implements Runnable { public void run() { System.out.println("run."); throw new RuntimeException("Problem"); } public static void main(String[] args) { Thread t = new Thread(new Exp1()); t.start(); System.out.println("End of method."); } } /*Which two can be results? (Choose two.) A. java.lang.RuntimeException: Problem B. run. java.lang.RuntimeException: Problem C. End of method. java.lang.RuntimeException: Problem D. End of method. run. java.lang.RuntimeException: Problem E. run. java.lang.RuntimeException: Problem End of method.

Output : Exception in thread "Thread-0" java.lang.RuntimeException: Problem at com.kesav.core.Exp1.run(Exp1.java:7) at java.lang.Thread.run(Unknown Source) run. */

The above is the out put of the program.

Ads









Related Tutorials/Questions & Answers:
What is the answer and how the program work?
how to get following answer in turbo c program
Advertisements
ModuleNotFoundError: No module named 'workq'
ModuleNotFoundError: No module named 'workq'
answer me this program
answer me this program
ModuleNotFoundError: No module named 'python-workq'
What is GPS Vehicle Tracking? How it Works?
how the answer is 13 can anyone explain plz
How Google News Works?
what is wrong in this program......
How does getcurrentsession() method works in hibernate sessionfactory?
what is wrong with this program
what is wrong in this program
What is GPS and How It Works?
what is ment by jdbc and how to connect with database?
how to creat a new program
what's the logic for create pattern program
What is the real use of Java Program
What is the real use of Java Program
what error in this program plese correct it
What is jQuery and how it is used?
What is jQuery and how it is used?
How GPS Tracking System Works
How Jdbc program can be run??
How Fleet management System works
how to run rmi program
how to run this program?
How to write Java Program
how to make a program on array
how to write this program

Ads