If you want to compare String objects as literals, use the intern() method.

Micael

At 03:58 PM 3/11/02 +0700, you wrote:
>Hi,
>     For the brave, can anyone guess why with this rather unsociable code:
>
>
>   if ((res.getString(3) == null) || (res.getString(3) == "")) {
>        out.println("<td><a href=takeDetails.jsp?timeSlot=" +
>res.getString(2) + "&myDate=" + myDate + ">" + res.getString(2) +
>"</a></td>");
>    }
>   if ((res.getString(3) != null) || (res.getString(3) != "")) {
>        out.println("<td>" + res.getString(3)+ " " + res.getString(2) +
>"</td>");
>    }
>
>
>the first condition is NEVER satisfied, even though out.println of
>res.getString(3) does not display anything! Ie res.getString(3) IS null,
>empty or whatever, but the condition is never satisifed. Quickly again, this
>is executed:
>
>
>   if ((res.getString(3) != null) || (res.getString(3) != "")) {
>        out.println("<td>" + res.getString(3)+ " " + res.getString(2) +
>"</td>");
>    }
>
>
>even though - out.println("<td>" + res.getString(3)+ " " -  shows it is
>empty (no output)!
>
>Thanks
>
>Paul.
>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to