Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

== operator for String



Hi,
as I understand how operator == works
following code will produce output
== not equal


String testString = "test";
testString += "1";
if(testString == "test1"){
System.out.println("== equal");
}else{
System.out.println("== not equal");
}

after compilation and running that code on MAC OS X I really received "== not equal"
no surprise :-)

but here is a question, if you look at source of class java.beans.XMLDecoder
from 1.4 JDK you will see many places like that:

if (name == "null" ||
name == "string" ||
name == "class" ||
isPrimitive(name)) {
return;
}

or

if (name == "void") {
how it could work?

so my question is there some changes to Java Language related to operator == for strings?
(I tried to look for languages changes on sun site, but didn't found, maybe I didn't try hard enough :-( )
thanks
Dmitry Markman
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.
References: 
 >Re: Mozilla 1.1 crashes loading applets (From: Matt Drance <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.