Right, but that isn't what the OP was asking, and it's not what you advertised it as (your original post said it was checking the null of the String). Again, in the OP's case, your suggestion would...
Type: Posts; User: KevinWorkman
Right, but that isn't what the OP was asking, and it's not what you advertised it as (your original post said it was checking the null of the String). Again, in the OP's case, your suggestion would...
It's not that you aren't allowed to post code, it's just that posting full code solutions (especially when your solutions aren't completely correct, like the code you posted in this thread that...
That does not test whether a Sting is null. In fact, that will result in an NPE if the String is null.
They weren't deleted, I moved them to the cafe. That's where non-technical questions go, so you'll be more likely to receive a response there.
I don't mean that you necessarily think I'm a jerk, but other people do get impatient when I ask to see their code- even though they're asking questions about their code!
The reason I'm asking for...
You can still use == to test against null.
Yep, that's why half of my responses are asking for an SSCCE. People think I'm just being a jerk, but it's actually because oftentimes the OP is...
I'm going to repeat this- without an SSCCE, we're having a really hard time understanding exactly what you're talking about. Post an SSCCE, and we'll go from there.
Nope. I'd suggest you throw together a little test program, too! :p
One more hint- It almost never makes sense to do someObject.equals(null).
Okay. Like I said, throw together an SSCCE (should be just a main method with a single if statement that tests a single String) that demonstrates what's going on that you don't understand, and we'll...
That won't work. Hint- What happens if str4 is indeed null?
You've had quite a bit of guessing at your problem, but without an SSCCE, that's all it is. Post an SSCCE that demonstrates your problem, and you'll get a more definitive answer.