Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #553
| From | Lew <noone@lewscanon.com> |
|---|---|
| Newsgroups | comp.lang.java.help |
| Subject | Re: String comparisons |
| Date | 2011-04-06 12:19 -0400 |
| Organization | albasani.net |
| Message-ID | <ini3qj$4mc$3@news.albasani.net> (permalink) |
| References | <87r59kpfgs.fsf@merciadriluca-station.MERCIADRILUCA> <4d9793b9$0$7284$426a74cc@news.free.fr> <87zko72rv4.fsf@merciadriluca-station.MERCIADRILUCA> |
Merciadri Luca wrote: > I can explain why 1., 2., 4. and 6. are respectively FALSE, TRUE, > TRUE and FALSE. > > Considering ints apart, the == operator returns TRUE e.g. in a == b if > a and b are same objects. As a result, d != s is true, and d == s is > false because d and s are not the same objects. More precisely, they are not objects at all but pointers to objects. > For question 2., d == c is true because of the affectation String c = > d. That is, d and c are exactly the same object. Not true. They are pointers to the same object. > This was not what I had understood from reading Aéris' message at > first sight, but re-looking at it, this is the same > explanation. Thanks, Aéris. I would have better understood if one had > said that == tests if the two objects are the same! That's in the tutorials. You should read the tutorials. We've been recommending them for a long time. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg
Back to comp.lang.java.help | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
String comparisons Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-02 22:26 +0200
Re: String comparisons Aéris <aeris@imirhil.fr> - 2011-04-02 23:23 +0200
Re: String comparisons Aéris <aeris@imirhil.fr> - 2011-04-02 23:27 +0200
Re: String comparisons Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-03 18:59 +0200
Re: String comparisons Lew <noone@lewscanon.com> - 2011-04-06 12:19 -0400
Re: String comparisons Roedy Green <see_website@mindprod.com.invalid> - 2011-04-02 21:17 -0700
Re: String comparisons Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-03 12:07 +0200
csiph-web