Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #504
| Date | 2011-04-03 08:55 -0700 |
|---|---|
| From | Patricia Shanahan <pats@acm.org> |
| Newsgroups | comp.lang.java.help |
| Subject | Re: Constructors order of invocation |
| References | <878vvsqvat.fsf@merciadriluca-station.MERCIADRILUCA> <in9ouh$k80$1@dont-email.me> |
| Message-ID | <F5udnYlGL8ziBQXQnZ2dnUVZ_sqdnZ2d@earthlink.com> (permalink) |
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. Patricia
Back to comp.lang.java.help | Previous | Next — Previous in thread | Next 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