Marijana Rukavina

Greenhorn
+ Follow
since May 21, 2014
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Marijana Rukavina

I cannot see any point in writing if (null != obj)… because nobody will write = instead of !=



There is no point, but regarding the previous thing I talked about (null == obj), where obj is of type Boolean, this (null != obj) would be just a consequence of that (in order to maintain, let's say, coding style)
9 years ago
Hi Matthew,

I thought it might be useful for other people how stumble upon it during the search, as I did just now
But, if it is not the forum policy, then I wouldn't do this again
9 years ago

Originally posted by Vinu krish:
I also saw another style of coding. I normally use the following
if(abc!=null). But I came across the following style if(null!=abc). Again any specific reason for doing this this or is it only a coding style?



This is usually done because when typing null == abc you are forced to put == and not = (because null is not a reference), in case abc were of type Boolean. This is in order to prevent those kind of logically not intended bugs. I suppose the same logic applies here (null != abc).
Personally I don't like it, but some people use it.
9 years ago