Plz do help with the null pointer exception

your code is giving Null pointer exception because your string s1 is null . Also when you want to check when length of string becomes 0 use length() instead of ‘==’ .