• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Exception types

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

Is there difference between exceptions typically thrown by JVM/Programmatically and Runtime/Checked exceptions?
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Andry Dub:
Hi!

Is there difference between exceptions typically thrown by JVM/Programmatically and Runtime/Checked exceptions?



in java programing: you can catch runtime error with try/catch.

try{
badExpressions;
}catch(RuntimeException ex)
{

}

but any error by jvm,will stop your program and running fail.
indeed you can't catch jvm error(exception)!
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi!

Is there difference between exceptions typically thrown by JVM/Programmatically and Runtime/Checked exceptions?



A RuntimeException (and any subclass) is an unchecked exception, so it is not required to be caught. The default consequence of an unchecked exception is that a message will be sent to the console.

An Error (and any subclass) is also an unchecked exception, although I believe most Errors result in the JVM halting processing. Hence, there isn't much point in trying to catch an Error, becuase is is unlikely that the code could recover from it.

All other exceptions are checked exceptions. This means that code calling the method(s) that throw the exception must have a try/catch block.

This link might also help: http://java.sun.com/docs/books/tutorial/essential/exceptions/runtime.html
 
No one can make you feel inferior without your consent - Eleanor Roosevelt. tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic