He created the class declared by the object and initialized it. But in some circumstances, we can get a "null link". He commented that there are 1,000 possible reasons for such an exception, and asked me to guess one reason. I canβt figure it out. What is (is) the reason (s), can we get such an exception?
The direct answer . I would tell the interviewer that you cannot debug code that you do not see. Ask to see an offensive line of code and a debugger.
A difficult answer . Assuming your interviewer is not an idiot, he probably feels that you have worked out your debugging skills. If you get an error message, you throw up your hands and give up right away, or you are trying to resolve it.
Guessing is not an acceptable way to debug an error. The first step is to reproduce the error on your computer.
Does it faithfully reproduce? If so, release the debugger.
If not, can you reproduce it intermittently or without determinism? Does the exception happen by accident in different places in the code or on different threads? If so, you probably have some kind of race condition or possibly a damaged pointer.
If not, ask who found the error to reproduce. When you follow the same steps as the person who initially found the error, can you reproduce? If yes, see above.
If not, is there a difference in the environments? Configuration files? Data in databases? Is the environment updated with the latest service packs, software updates, etc.
You will not be able to give your interviewer an answer, but you can give him a list of steps that you will take to get an answer.
Juliet
source share