Answer the question
In order to leave comments, you need to log in
Is it possible to check unchecked exceptions in java?
I recently had an interview on java. When it came to unchecked exceptions, I answered what I gleaned from the literature: that it is possible to catch unchecked exceptions, but this is bad practice, and you need to write code so that they do not occur. To which the interviewer asked me the question: "What if I need to make a number from a string using Integer.valueOf, which throws an unchecked exception? Catch or not? Do not crash the application." As a result, I did not understand what answer the interviewer was waiting for.
In this connection, the question is: are there cases when you still need to catch unchecked exceptions? And what should be done in the case of Integer.valueOf?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question