It's not a secret anymore!
The moose likes Programmer Certification (SCJP/OCPJP) 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 » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "exception handling??" Watch "exception handling??" New topic

exception handling??

srikanth reddy
Ranch Hand

Joined: Jul 28, 2005
Posts: 252

here i thought that A and c are printed...
but not its compile error...
exception is never thrown in the corresponding try block ...
i didnt get it ...
instead of i kept java.lang.Exception it worked fine...
whats the concept behind this???

Thanks & Regards<br /> <br />-Srikanth
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
IOException is a checked exception you are trying to catch it but it's not thrown so the compiler is smart and throws a compile time error. But this is not the case with the class Exception , even though it's not thrown explicitly , there are possibility of getting runtime exceptions like NullPointer hence it compiles
[ October 13, 2005: Message edited by: Srinivasa Raghavan ]

Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
I agree. Here's the link:
subject: exception handling??
jQuery in Action, 3rd edition