wood burning stoves 2.0*
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
Although activation.jar,mail.jar are in the same folder I get in compile(well?)
need help optimizing this image printing applet
XML dealing with the NamedNodeMap interface
Help for the below sample code
Weird thing happening in Linked Lists