NullPointerException

This post is to makde a NullPointerException and explain a little bit. See the capture first.

U can see that the value of string[1] is NULL, then the code wants to use charAt() method to call it. Finally there’s a NullPointerException error.
This error is always because we want to operate an object which is not initialized yet.
During test work, we also see NullPointerException error. While, without checking code, it’s hard for testers to know the real reason.

原文地址:https://www.cnblogs.com/backpacker/p/2271195.html