This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Hi, I have a problem with String objects that were set to null. I have a String object token, and token.toString() returns null. But when I make equivalence test with (token==null) and (token.equals(null), both returned false. How can I test if a String object to be null? Thanks!
If a String object is null, it can be compared to null. In your example, (token == null) will return true if String is null and token.toString() will throw a NullPointerException. What you have is a String object which has a value of "null" try token.equals("null") Hope this helps