[6095] in java-interest

home help back first fref pref prev next nref lref last post

Re: How to check for null ....

daemon@ATHENA.MIT.EDU (Steve Nelson)
Tue Mar 19 15:22:45 1996

Date:         Mon, 18 Mar 1996 19:55:14 -0800
Reply-To: Java Interest <JAVA-INTEREST@JAVASOFT.COM>
From: Steve Nelson <senelson@MEDIACITY.COM>
To: Multiple recipients of list JAVA-INTEREST
              <JAVA-INTEREST@JAVASOFT.COM>

Hmm... my guess would be:

if (mystring == null)
        System.out.println(mystring + "\n is not null");
else System.out.println("String is null.");

I've used similar things in the past.


>In 'C', I could have done something like this :
>
>if(mystring)                            /* Just a crude example */
>        printf("\n string is not null);
>else
>        printf("string is null");
>
>Is there any method (or) a specific way to check for strings with null in it.
>
>Thanks
>
>Dhaval
>
>--
>=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
>   Dhaval M. Shah
>   dhaval@cs.uow.edu.au                 (Home) : +61 42 258519
>   Dept. of Computer Science
>   University of Wollongong             2/13 Catherine St., Gwynneville,
>   NSW 2522     Australia               NSW 2500     Australia
>=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+

=SN

Steve Nelson
MediaCity HTML Design Staff                     Phone: (415) 854-9634
senelson@mediacity.com                          Fax:   (415) 854-4655
---------------------------------------------------------------------

home help back first fref pref prev next nref lref last post