473,416 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

What is the difference between object !=null and null !=object?

karthickkuchanur
156 100+
Dear Experts,

Please let me know what is the difference between difference between object !=null and null !=object,I already google it but i can't able to find the right answer
Oct 25 '10 #1
3 8088
code green
1,726 Expert 1GB
It is the same test whichever way it is written.
object != null is more intuitive when reading the code.

But in some cases in some languages an error will be thrown if the object does not exist.
Whereas the other way around null != object will not complain.

I can't remember (Monday morning) exactly what the circumstances are, but null != object can be safer.
Oct 25 '10 #2
karthickkuchanur
156 100+
Actually ,this question is asked by manager ,I think there something behind this check ,there must be difference in java
Oct 25 '10 #3
jkmyoung
2,057 Expert 2GB
In C++ where operators could be overwritten, this might make a difference. With Java objects, I think it just compares the addresses of the two.
Oct 25 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Asad Khan | last post by:
I have the following method in a class 'foo'. public boolean equals(Object o) { if (!(o.equals(null))) { // do some stuff } } The problem I am having is that, if the object that is passed...
3
by: Asad Khan | last post by:
public boolean equals(Object o) { if (!(o.equals(null))) { // * if (o instanceof foo) { if (this.equals(o)) { return true; } } } return false; }
38
by: VK | last post by:
Hello, In my object I have getDirectory() method which returns 2-dimentional array (or an imitation of 2-dimentional array using two JavaScript objects with auto-handled length property - please...
2
by: shland | last post by:
Hi - I have a page in which I'm using session variables... The first time someone goes to the page, obviously the session objects are null. But the user can return to the page, at which time the...
5
by: Miguel | last post by:
ey, I m trying to make a new httpmodule but the session object is null. I m implementing IReadOnlySessionState but it keep on being null. I m novice in this enviroment, does anybody know what's...
12
by: Joe | last post by:
I might be overworked so please excuse this stupid question... Say I do the following: DataTable table = new DataTable(); myDataAdaptor.Fill(table); dataGrid1.DataSource = table;
35
by: eyoung | last post by:
I call a function that takes the unit price and quantity ordered to create an amount...it looks something like this. function calculateCost() { quantity=document.RFO.quantity.value;...
7
by: TS | last post by:
I get this message in the window "cannot assign 'null' into 'xxxxx'". this is an object and hence a reference type. Sometimes this isn't permitted...why? thanks
3
by: Mitra Dharan | last post by:
Hi! Can someone clarify my doubt? Is there any difference in between null == object and object == null comparison? If so what is it? Thanks! Mitra
20
by: Justin Rich | last post by:
so im trying to be good and not leave anything hanging open but i guess ive seen a variety of ways to kill objects.. is there like a recommended way? basically im looking for best practices for...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.