aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes on exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "on exception" Watch "on exception" New topic
Author

on exception

velan vel
Ranch Hand

Joined: Nov 15, 2005
Posts: 137
hai
here how many statements are true?




A. catch(X x) can catch subclasses of X.
B. The Error class is a RuntimeException.
C. Any statement that can throw an Error must be enclosed in a try block.
D. Any statement that can throw an Exception must be enclosed in a try block
E. Any statement that can throw a RuntimeException must be enclosed in a try
block..

by
velan vel
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Only A is true. An instance of a subclass of X is also an instance of X.

B is false (see API). C is false because Errors are unchecked. D and E are both false because a RuntimeException is an unchecked Exception.

(For C, D, and E, even if these were checked, the statements would still be false. A "throws" declaration could be used in lieu of a try block.)


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: on exception