[6069] in java-interest
Re: How to check for null ....
daemon@ATHENA.MIT.EDU (Matthew Cravit)
Mon Mar 18 21:41:27 1996
Date: Mon, 18 Mar 1996 14:54:41 -0600
Reply-To: Java Interest <JAVA-INTEREST@JAVASOFT.COM>
From: Matthew Cravit <mcravit@CONDOR.DEPAUL.EDU>
To: Multiple recipients of list JAVA-INTEREST
<JAVA-INTEREST@JAVASOFT.COM>
In-Reply-To: <199603180817.TAA28948@wraith.cs.uow.edu.au>
On Mon, 18 Mar 1996, Dhaval M Shah wrote:
>
> I am a student with good 'C' background and trying to learn
> java.
>
> I have created a string that depending upon input either has some characters or
> has "null" in it. [Or rather the string is null]
>
> My problem is how to check for nullity in java. If the string has "null" and
> I use mystring.length() in the hope that it should return 0, java throws
> a runtime exception.
I haven't tried this yet (I have Java on my home machine, but not my work
machine yet), but perhaps you could use "if (mystring.equals(null))" to
accomplish this.
/MC
--
Matthew Cravit, N9VWG
Technical Support Specialist, DePaul University Libraries, Chicago, IL
E-Mail: mcravit@condor.depaul.edu or mcravit@wppost.depaul.edu
<A HREF="http://condor.depaul.edu/~mcravit/index.html">My Home Page</A>