Whats the difference between a runtime exception and a plain exception-why don runtime exceptions have to be declared?
Ans : The Java language specifies that all runtime exceptions are exempted from the standard method declarations and compiler checks; such exceptions belong more to the system as a whole than to the method that happens to be executing when the exception is thrown. The Java language lets you signal conditions (usually error conditions) by throwing an object at one point in your code, such that an enclosing block can catch the object and infer from it the trigger condition. The object you throw must belong to the Throwable class or one of its subclasses. The class hierarchy under Throwable further classifies the nature of the unusual condition. Throwable subdivides into two subclasses, which The Java Application Programming Interface (Vol. 1) demarcates nicely: • Error: “indicates serious problems that a reasonable application should not try to catch.” (p. 175) • Exception: “indicates conditions that a reasonable application might want to catch.” (p. 162) Errors are never declaredthey ar
Related Questions
- Can custom exceptions be created in the database? That is, when some specific action happens can a user defined exception (that is stored in the database) be created and raised?
- Whats the difference between a runtime exception and a plain exception-why don runtime exceptions have to be declared?
- When I use HttpUnit, I get a runtime exception - HttpUnit is looking for something called org.w3c.xml.Tidy. Where is this?