*
The moose likes Beginning Java and the fly likes Exception code. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Exception code." Watch "Exception code." New topic
Author

Exception code.

Ritesh raushan
Ranch Hand

Joined: Aug 29, 2012
Posts: 100

what is the output of this program and how please explain .





Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37962
    
  22
We don’t simply answer such questions. Please explain what you think the output is, and we shall say whether we agree.
You must also tell us where the question comes from.
Buddhika Mawella
Ranch Hand

Joined: Jan 06, 2011
Posts: 39

Hint : first think about java exception catching order.


BM
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4343
    
    8

Of course, the best way to find out for certain what the output is (once you've thought about what you think it should be) is to actually compile and run the code.
Ritesh raushan
Ranch Hand

Joined: Aug 29, 2012
Posts: 100
ouput is (Ex0 caught) but i didn't understand how did.
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2172
    
  47
What did you expect it to be and why?
Gaurangkumar Khalasi
Ranch Hand

Joined: Jun 02, 2012
Posts: 186
Because of inheritance...

Exc0 e0 = new Exc1();
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37962
    
  22
Gaurangkumar Khalasi wrote:Because of inheritance...

Exc0 e0 = new Exc1();
Correct. What you need to do is follow the path of execution, with a pencil on the code. You should be able to confirm that easily.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception code.
 
Similar Threads
Understanding Exceptions
Exception
Exception handling!!
Is this JWhiz thread question wrong?
need help on Exceptions