Re: determining if a string is null
From: Chris Smith (cdsmith_at_twu.net)
Date: 11/24/03
- Next message: GIMME: "Re: Advice for the XML to db problem"
- Previous message: Roedy Green: "Re: Looping over arrays."
- In reply to: Gary N.: "determining if a string is null"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 24 Nov 2003 11:54:53 -0700
Gary N. wrote:
> Is there an easy way to determine if a string is null?
>
> String a = null;
> a.equals(""); // doesn't work
Just to add to your other replies... you're using terminology in a
dangerous way here. In the code above, you can't really check to see if
a String is null, because there isn't a String there at all. Instead,
you have a reference, and that reference is *capable* of pointing to a
String... but the whole meaning of 'null' is that there is no String
there at all. (Furthermore, if there were a String, it would
meaningless to say that the String "is null". Only references can be
null.)
-- www.designacourse.com The Easiest Way to Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation
- Next message: GIMME: "Re: Advice for the XML to db problem"
- Previous message: Roedy Green: "Re: Looping over arrays."
- In reply to: Gary N.: "determining if a string is null"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|