Hi Charles,

> A few notes:
> 
> 1) java.lang.Comparable is new in Java2.  It's not there
>    if you are running w/Java 1.1 (OK with Tomcat 3.x).
> 
> 2) compareTo(), for Strings does a *lexical* comparison.
>    Semantically, this code wants to know that the user
>    is "admin", not that the user is lexically equivalent
>    to "admin".  Using equals() describes the operation
>    semantically better than compareTo().
> 
> 3) You should use:
> "admin".equals(user)
>    That avoids a potential NullPointerException.

When can you get on of these? Or did you mean ClassCastException?


Reply via email to