Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #849
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Mon, 11 Jul 2011 21:02:10 -0500 |
| Date | Mon, 11 Jul 2011 19:02:01 -0700 |
| From | Patricia Shanahan <pats@acm.org> |
| User-Agent | Mozilla/5.0 (Windows NT 5.2; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.java.help |
| Subject | Re: Instantiation of a class |
| References | <d98a873f-d5db-4243-be26-2109c25744b2@q12g2000prb.googlegroups.com> <ivg9md$c1c$1@dont-email.me> |
| In-Reply-To | <ivg9md$c1c$1@dont-email.me> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Message-ID | <lcadnRwToZK_NobTnZ2dnUVZ_oudnZ2d@earthlink.com> (permalink) |
| Lines | 28 |
| X-Usenet-Provider | http://www.giganews.com |
| NNTP-Posting-Host | 75.11.53.97 |
| X-Trace | sv3-wgprsHXAmpZwOQzmxh0sQOYz1V50Db0YoTrcUhaWoCFBkT0irwYG6CxxxxheNTOr6MtSchB4e4gGQ4J!7nV4fVrEfTeIRIF2TvCX8aRFYRm5FeNxnmpgqWk1VXnD2CIicfGPjFwOkznJksBikTZ9CtBlFM/v!6TG0PVyFultbT4xNKeR0b9GDQWOWlJrVSm5GZCUgruM= |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 2028 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.help:849 |
Show key headers only | View raw
On 7/11/2011 6:57 PM, Eric Sosman wrote:
> On 7/11/2011 7:03 PM, Fred wrote:
>>
>> I'm thinking about statements like String foo = new String("foo");
>> When is the constructor specified not the name of the type of
>> reference variable?
>
> Aside: The example is sort of silly, because one seldom needs
> two instances of the same String.
>
> At the risk of answering a homework question, I can think of
> two situations in which `x = new Y(...)' works even though x does
> not have type Y. First, x's type may be that of one of Y's
> superclasses, or of an interface implemented by Y. Second, the
> class that's instantiated might not have a name the Java source
> code can speak.
>
> And maybe the gurus will think of additional possibilities.
>
Unboxing:
int x = new Integer(3);
Yuck!
Patricia
Back to comp.lang.java.help | Previous | Next — Previous in thread | Next in thread | Find similar
Instantiation of a class Fred <albert.xtheunknown0@gmail.com> - 2011-07-11 16:03 -0700
Re: Instantiation of a class lewbloch <lewbloch@gmail.com> - 2011-07-11 16:41 -0700
Re: Instantiation of a class lewbloch <lewbloch@gmail.com> - 2011-07-11 16:54 -0700
Re: Instantiation of a class Mayeul <mayeul.marguet@free.fr> - 2011-07-12 02:02 +0200
Re: Instantiation of a class Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-07-11 21:57 -0400
Re: Instantiation of a class Patricia Shanahan <pats@acm.org> - 2011-07-11 19:02 -0700
Re: Instantiation of a class Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-07-11 22:10 -0400
Re: Instantiation of a class Fred <albert.xtheunknown0@gmail.com> - 2011-07-11 20:29 -0700
Re: Instantiation of a class lewbloch <lewbloch@gmail.com> - 2011-07-12 14:35 -0700
Re: Instantiation of a class Gene Wirchenko <genew@ocis.net> - 2011-07-11 21:25 -0700
Re: Instantiation of a class Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-07-12 07:47 -0400
Re: Instantiation of a class lewbloch <lewbloch@gmail.com> - 2011-07-12 11:09 -0700
csiph-web