Online Hibernate Training just in Rs. 1000

One week online training in Hibernate ORM framework. Learn Hibernate Framework and enhance your skills. Best Online Hibernate training at 90% discount. Join Now!! Offer is valid Only for limited Period!!! Online Training Big Data and Hadoop Training Java Training  
 

What is the answer and how the program work?

Ads

 
 

Share on Google+Share on Google+

Rupan Paul
What is the answer and how the program work?
1 Answer(s)      5 years and a month ago
Posted in : Java Beginners

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.

Ads
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:
Advertisements