This week's giveaways are in the MongoDB and Jobs Discussion forums. We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line! See this thread and this one for details.
str = NULL will not compile. 'NULL' is not a Java keyword.
Also str = null will not throw a NullPointerException by itself. A NullPointerException is thrown when you try to call a method on a variable that is null. So if you set str to null and then call a method on str, then you will get a NullPointerException.
Originally posted by Jesper Young: str = NULL will not compile.
Unless NULL is defined somewhere, of course, for example as a field.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
To expand on this, remember that Java is case sensitive. So the keyword "null" is not the same as "Null" or "NULL" or any other combination of upper/lowercase. None of these other case variations have any meaning (unless you specifically define them as your own identifier).
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Burkhard Hassel
Ranch Hand
Joined: Aug 25, 2006
Posts: 1274
posted
0
Please don't post multiple threads with the same subject.