Organizational Research By

Surprising Reserch Topic

Question:Why Runtime Exceptions are Not Checked?



asked Sep 13, 2013 in Java Interview Questions by rajesh
edited Sep 12, 2013
0 votes
31 views



Related Hot Questions

2 Answers

0 votes

 

The runtime exception classes (RuntimeException and its subclasses) are exempted from compile-time checking because, in the judgment of the designers of the Java programming language, having to declare such exceptions would not aid significantly in establishing the correctness of programs. Many of the operations and constructs of the Java programming language can result in runtime exceptions. The information available to a compiler, and the level of analysis the compiler performs, are usually not sufficient to establish that such run-time exceptions cannot occur, even though this may be obvious to the programmer. Requiring such exception classes to be declared would simply be an irritation to programmers.

answered Sep 13, 2013 by rajesh
edited Sep 12, 2013
0 votes

 

The runtime exception classes (RuntimeException and its subclasses) are exempted from compile-time checking because, in the judgment of the designers of the Java programming language, having to declare such exceptions would not aid significantly in establishing the correctness of programs. Many of the operations and constructs of the Java programming language can result in runtime exceptions. The information available to a compiler, and the level of analysis the compiler performs, are usually not sufficient to establish that such run-time exceptions cannot occur, even though this may be obvious to the programmer. Requiring such exception classes to be declared would simply be an irritation to programmers.

answered Sep 13, 2013 by rajesh
edited Sep 12, 2013

...