We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Fine, but what's the point of showing an exception message in a different way than the other? If you use that, it will give you an error when in the division by zero test case.
Why one exception should show the extra content and the other not? This is not even part of the exercise.
What they could do if they really want a nice representation of the exceptions, could be we print something like "This is an input mismatch exception" and "This is an arithmetic exception".
This would force people to know which exceptions could happen and don't use the generic Exception.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Exception Handling (Try-catch)
You are viewing a single comment's thread. Return to all comments →
Fine, but what's the point of showing an exception message in a different way than the other? If you use that, it will give you an error when in the division by zero test case.
Why one exception should show the extra content and the other not? This is not even part of the exercise.
What they could do if they really want a nice representation of the exceptions, could be we print something like "This is an input mismatch exception" and "This is an arithmetic exception".
This would force people to know which exceptions could happen and don't use the generic Exception.