Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #515
| From | Eric Sosman <esosman@ieee-dot-org.invalid> |
|---|---|
| Newsgroups | comp.lang.java.help |
| Subject | Re: Constructors order of invocation |
| Date | 2011-04-03 14:16 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <inadh6$a3t$1@dont-email.me> (permalink) |
| References | <878vvsqvat.fsf@merciadriluca-station.MERCIADRILUCA> <in9ouh$k80$1@dont-email.me> <F5udnYlGL8ziBQXQnZ2dnUVZ_sqdnZ2d@earthlink.com> |
On 4/3/2011 11:55 AM, Patricia Shanahan wrote:
> On 4/3/2011 5:24 AM, Eric Sosman wrote:
> ...
>> The pattern above (S3->S2->S1->Object->S1->S2->S3) always
>> runs as described, unless somebody throws an exception or calls
>> System.exit() or takes some similar drastic action that aborts
>> the construction. All you can hope to control is which of several
>> possible S3/S2/S1 constructors is used, for classes that have more
>> than one....
>
> Although I agree in general with this explanation, it does ignore one
> way of changing the patter of constructor calls.
>
> A constructor can start by invoking another constructor in the same
> class, instead of a superclass constructor. In that case the pattern
> might be S3->S3->S2. It is useful for providing default constructor
> parameters.
Good catch. Thanks!
--
Eric Sosman
esosman@ieee-dot-org.invalid
Back to comp.lang.java.help | Previous | Next — Previous in thread | Find similar | Unroll thread
Constructors order of invocation Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-02 21:59 +0200
Re: Constructors order of invocation Lew <noone@lewscanon.com> - 2011-04-02 17:20 -0400
Re: Constructors order of invocation Roedy Green <see_website@mindprod.com.invalid> - 2011-04-02 21:33 -0700
Re: Constructors order of invocation Merciadri Luca <Luca.Merciadri@student.ulg.ac.be> - 2011-04-03 11:07 +0200
Re: Constructors order of invocation Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-04-03 08:24 -0400
Re: Constructors order of invocation Patricia Shanahan <pats@acm.org> - 2011-04-03 08:55 -0700
Re: Constructors order of invocation Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-04-03 14:16 -0400
csiph-web