| 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.
|
 |
 |
|
|
subject: null problem
|
|
|