Originally posted by Randall Twede:
it is a good practice. kind of like saying please and thank you. no, you dont have to do it. yes, it might not make any difference. but is a good habit to develop.
I disagree with Ilja Preuss.
And as long as you don't put these sentences above into a comment, the code says something different to me. It says:
I was written by a foreign-language-programmer, who is used to nulling.
Or written by a pupil of a foreign-language-programmer, who blinly believed everthing what he or she saw.
Or it is written by desperate I-make-everthing-in-my-own-way hacker, who implemented his own compiler and jvm, which had a minor bug.
Do you write code like this:
Why not?
Last but not least: Setting a variable to null is a great performance-tradeoff, since it needs an additional assignment.