Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Whats the difference between a runtime exception and a plain exception-why don runtime exceptions have to be declared?

0
10 Posted

Whats the difference between a runtime exception and a plain exception-why don runtime exceptions have to be declared?

0
10

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

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123