Mark Galbreath wrote:
> there is (a) a definite difference between a string (literal) and
> a String (object) when it comes to some of the API methods.
>
No, there is no difference at all. A string literal
is an Object of class String. The language spec is
very explicit on this point.
> (c) We know that equals() will accept a literal, but the J2EE API
> states specifically that "getAttribute" takes a string as its first
> parameter and an object as its second.
>
A string literal is a String, and a String is an
Object. There is nothing special about how equals()
handles string literals. You can go look at the
source to String.equals(), it's completely
straightforward how it works: it checks if the
argument is the same object, then it compares the
characters one by one.
Colin Capriati wrote:
>
> For brevity you could also try:
> application.setAttribute("errorMessage",new String("NO Error Message"));
>
There is no need to create a new String, or do any
casting, or anything like that. The call is perfectly
fine as:
application.setAttribute("errorMessage", "This is an error message")
This thread has been filled to bursting with
incorrect information guaranteed to confuse the
newbies in the audience. Can we please just stop
the madness and get back on-topic?
-cks
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html