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

Exception Handling

pankaj agarwal
Ranch Hand

Joined: Oct 13, 2000
Posts: 39
Hi!
I came across this question in one of the tests. Can you help me out on this, please?
Thanks in advance
pankaj
In regards to exceptions, which of the following are true?





a) An exception can be thrown by a no argument constructor.

b) An exception can only be thrown by a multi argument constructor.

c) Uncaught exceptions should be listed in the throws clause of a class definition.

d) In all cases except exiting the JVM, the finally clause of a try block is executed.


I know option d) is true, is any of the other options true also?
Sean MacLean
author
Ranch Hand

Joined: Nov 07, 2000
Posts: 621
a) & b) are false because constructors cannot throw exceptions.
Similarly c) is false because classes do not explictly throw exceptions.
Sean
deekasha gunwant
Ranch Hand

Joined: May 06, 2000
Posts: 396
Hi pankaj,
option a,d are correct.
and
constructors can throw exceptions
if u don't belive confirm it by running the following code.

regards
deekasha
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception Handling