Recently I was at an interview and the interviewer asked me regarding exception handling. I gave the typical checked unchecked answer. Then He asked me should you handle runtime exception ? I said no and then it was asked that if we get a NullPointerException suppose, will you send the same to the user ?
I got confused. So what I am looking for is that, should we catch runtime exceptions or not ?
- If Yes, How can we do that ?
- If No, then do we show java.lang.nullpointerException to the user ?
Thanks in advance.