[6084] in java-interest
Re: How to check for null ....
daemon@ATHENA.MIT.EDU (Hai Nguyen)
Tue Mar 19 12:48:25 1996
Date: Tue, 19 Mar 1996 08:49:46 -0800
Reply-To: Java Interest <JAVA-INTEREST@JAVASOFT.COM>
From: Hai Nguyen <cuhi@FTA.COM>
To: Multiple recipients of list JAVA-INTEREST
<JAVA-INTEREST@JAVASOFT.COM>
> 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.
Try this. It should be useful for you.
public class toto {
public static void main(String argv[])
{
String str = null;
if (argv.length == 1)
str = argv[0];
if (str == null)
System.out.println("toto(no-arg)");
else
System.out.println("toto(" + str + ")");
}
}
Hai.
Thurber Technology Group, Portland, OR