Why does it make sense to have Runtime Exceptions UnChecked (as opposed to if they were Checked)?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you didn’t you would have to have try/catch blocks every time you accessed an array element, did a division operation and many other common scenarios.
To put it another way, imagine this code:
would have to check for
ClassCastException,ArrayIndexOutofBoundsException,ArithmeticException,UnsupportedOperationExceptionandNullPointerExceptionjust off the top of my head.With Java the issue isn’t unchecked exceptions. Checked exceptions are a highly controversial subject. Some say this was largely an experiment with Java and in practice they don’t work but you will find plenty of people who argue they are good.
No one is arguing unchecked exceptions are bad however.