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.