Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #31106
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: "null", polymorphism and TCO |
| Date | Tue, 10 Feb 2015 12:51:01 -0600 |
| Organization | A noiseless patient Spider |
| Lines | 18 |
| Message-ID | <mbdjti$492$1@dont-email.me> (permalink) |
| References | <null-20150208185452@ram.dialup.fu-berlin.de> <mcmurtrie-19F4EE.23064308022015@news.sonic.net> <mba2ip$3nr$1@gwaiyur.mb-net.net> <mcmurtrie-338D50.20354409022015@news.sonic.net> <mbcjh4$388$1@gwaiyur.mb-net.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Tue, 10 Feb 2015 18:50:26 +0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="8cedddb29338592f734c41b16a68fadc"; logging-data="4386"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+saXoR8byspHOxYF8FzqZ3Ta18ks2RA+I=" |
| User-Agent | Mozilla/5.0 (Windows NT 6.3; WOW64; rv:34.0) Gecko/20100101 Thunderbird/34.0 |
| In-Reply-To | <mbcjh4$388$1@gwaiyur.mb-net.net> |
| Cancel-Lock | sha1:cDsQCEoacclnialTcl1eZ12EZXI= |
| Xref | csiph.com comp.lang.java.programmer:31106 |
Show key headers only | View raw
On 2/10/2015 3:37 AM, Marcel Mueller wrote: > But this does not apply if you assign string constants. E.g. > > String s1 = "foo"; > s1 == "foo" // might be true > > Probably it will be true in most cases since the Java compiler will > likely not create two instances of the same constant. But I am unsure > what happens if the two lines are in different java or jar files. I > think it is simply undefined behavior. The JLS mandates that all compile-time string constants (this includes "fo" + "o") are references to their appropriate interned string, so it's guaranteed that "foo" == "foo".intern(). -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: "null", polymorphism and TCO Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2015-02-08 23:06 -0800
Re: "null", polymorphism and TCO Marcel Mueller <news.5.maazl@spamgourmet.org> - 2015-02-09 11:36 +0100
Re: "null", polymorphism and TCO Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2015-02-09 20:35 -0800
Re: "null", polymorphism and TCO Marcel Mueller <news.5.maazl@spamgourmet.org> - 2015-02-10 10:37 +0100
Re: "null", polymorphism and TCO Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2015-02-10 12:51 -0600
csiph-web