Why you need to check both conditions?
if (this.sender.length() > 0 & this.receiver.length() >0)
If the first is false then the whole if will be false, thus there is no need to check the second...
Type: Posts; User: andreas90
Why you need to check both conditions?
if (this.sender.length() > 0 & this.receiver.length() >0)
If the first is false then the whole if will be false, thus there is no need to check the second...
If I were you, I would first check for null and then length() > 0, to avoid a NPE.
And also I would use the logical && instead of the bitwise & operator. They seem to work the same but they are...
If the updated isValid() method is the one from post#3, I think it will still throw a NPE, unless you gave the reciever a non null value. I told you that in your case a null sender is the same with a...
Hello Ouzi!
When you get an NPE you should print the variables in the line that the exception tells you to find which of them is null, and then you can find out why it is null.
Here the problem is...