问题 This question's answers are a community effort . Edit existing answers to improve this post. It is not currently accepting new answers or interactions. What are Null Pointer Exceptions ( java.lang.NullPointerException ) and what causes them? What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely? 回答1: When you declare a reference variable (i.e. an object) you are really creating a pointer to an object. Consider