aspose file tools*
The moose likes Java in General and the fly likes null problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "null problem" Watch "null problem" New topic
Author

null problem

Nick Lebian
Greenhorn

Joined: May 30, 2003
Posts: 9
Hi!
How can I find out, if the return value of a String method is null?
....
List list=new HashList();
for (int i=1; !this.getParameter("gap"+1).equals(null); i++)
{
System.out.println("While");
String gap=getGaps(this.getParameter("gap"+i));
String[] pointer=gap.split(";");
list.add(pointer);
}
...
But in this case, the for loop doesn't stop.
Angel Dobbs-Sciortino
Ranch Hand

Joined: Sep 10, 2003
Posts: 101
Try this:
for (int i=1; this.getParameter("gap"+1) != null; i++)
Angel
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
If the return value is the string "null", then it should be checked like this...
for (int i=1; !this.getParameter("gap"+1).equals("null"); i++)


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
Vladas Razas
Ranch Hand

Joined: Dec 02, 2003
Posts: 385
Very funny Ko Ko. Stop confusing poor guy.
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
Originally posted by Vladas R.:
Very funny Ko Ko. Stop confusing poor guy.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: null problem
 
Similar Threads
XML dealing with the NamedNodeMap interface
Help for the below sample code
need help optimizing this image printing applet
Weird thing happening in Linked Lists
Although activation.jar,mail.jar are in the same folder I get in compile(well?)