• Post Reply Bookmark Topic Watch Topic
  • New Topic

Differerce : NULL and Empty object?  RSS feed

 
Abhijit Das
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

How to find out that my object is empty NOT NULL? In detail, suppose my object is not NULL but as I print it , the value is empty .

Is it confused?
for the reading of below xml

In my code i got the TriggerTimer Node object which is startEventChildNode



As this not having any atrribute, what is the value???
 
Norm Radder
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Think of it like this:
You could have a bucket(object) in your hand or not. No bucket = null.
If you do have a bucket, does it have anything in it? Nothing in it = empty.
 
Campbell Ritchie
Marshal
Posts: 56518
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not NULL, it's null. At least in Java. NULL is permissible in SQL.

In Java, null is described as a state of non-existence. You can have fields which are equal to null (in fact that is their default state before they are initialised to a real value). You can initialise variables to null, and you can test whether they are null . . .

if (myObject == null) . . .

but you can't actually use them when null.

You can have String objects, or other objects, which are empty; in the case of a String you could use "", as Norm Radder has already told you. Hope that has been of help
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!