aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Exceptions kicking out of program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Exceptions kicking out of program" Watch "Exceptions kicking out of program" New topic
Author

Exceptions kicking out of program

yamini nadella
Ranch Hand

Joined: Apr 13, 2004
Posts: 257
According to my idea if we catch exceptions then some "fatal" exceptions will terminate the program after catch/finally execution. Some exceptions continue the execution after catching.
Exceptions like Filenotfound etc... are not fatal.execution can continue after catching that exception.
Here what exceptions are fatal and what are not? All Unchecked exceptions and Errors are Fatal?
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
Yamini,
You can think about exceptions as being one of three types:
  • Errors you expect to happen at some point. You should handle these. Most of the time these will be direct subclasses of Exception, but not RuntimeException, so the compiler will force you to catch or declare these.
  • Errors you know may happen, but don't expect. These are the RuntimeException-subclasses exceptions. You generally don't worry about these unless there are specific instances that you might want to cover (like NumberFormatException) if explicity stated by functions. Sometimes you won't even know what RuntimeExceptions can be thrown by code you call.
  • Lastly, there are the RuntimeErrors that can be thrown. These usually deal with things way out of your control, so you just let them do whatever they want. Examples being running out of memory or other JVM issues.

  • To answer your question though: any unchecked exception that isn't caught and handled by some catch block somewhere will force the JVM to quit with the usual stack trace and chaos.
    [ April 16, 2004: Message edited by: Nathaniel Stoddard ]

    Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
     
    jQuery in Action, 2nd edition
     
    subject: Exceptions kicking out of program