RE: expression ALWAYS evaluates to "if"... NEVER to "else"

2002-10-18 Thread Z.BEAT
My apologies for the easy question. I should have known. --- [EMAIL PROTECTED] wrote: > You'll want to do if( > !(paramPassword.equalsIgnoreCase(secretCode))) { } > else { } > > You cant use logical operators on Strings for what > you're trying to do! > > Look up the java.lang.String javadocs f

RE: expression ALWAYS evaluates to "if"... NEVER to "else"

2002-10-18 Thread alan sparago
ubject: Re: expression ALWAYS evaluates to "if"... NEVER to "else" Hello Z.BEAT, If these are both java String objects then all you are comparing is if the memory location of string object #1 is the same as that of String object #2. This is probably not true. You

RE: expression ALWAYS evaluates to "if"... NEVER to "else"

2002-10-18 Thread Sexton, George
You need to learn how java compares objects and strings. The short story is: if(!paramPassword.equals(secretCode)) { } else { } -Original Message- From: Z.BEAT [mailto:zackbeatty@;yahoo.com] Sent: 17 October, 2002 11:58 AM To: Tomcat Users List Subject: expression ALWAYS evaluates to "i

Re: expression ALWAYS evaluates to "if"... NEVER to "else"

2002-10-18 Thread Jacob Kjome
Hello Z.BEAT, If these are both java String objects then all you are comparing is if the memory location of string object #1 is the same as that of String object #2. This is probably not true. You need to compare like this. if (paramPassword.equals(secretCode)) { } else { } You can only coun

RE: expression ALWAYS evaluates to "if"... NEVER to "else"

2002-10-18 Thread Turner, John
You can't use "!=" or "==" to compare Strings. http://java.sun.com/j2se/1.3/docs/api/java/lang/String.html You could use something like: if (paramPassword.compareTo(secretCode) == 0) { // they match } else { // they don't } Or flip your "if" around and use .equals(): if (paramPassword

RE: expression ALWAYS evaluates to "if"... NEVER to "else"

2002-10-18 Thread SMcGarrity
You'll want to do if( !(paramPassword.equalsIgnoreCase(secretCode))) { } else { } You cant use logical operators on Strings for what you're trying to do! Look up the java.lang.String javadocs for more information on the equals and equalsIgnoreCase methods. Steve -Original Message- From