Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #515

Re: Constructors order of invocation

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!news2.arglkargh.de!easy.in-chemnitz.de!feeder.erje.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From Eric Sosman <esosman@ieee-dot-org.invalid>
Newsgroups comp.lang.java.help
Subject Re: Constructors order of invocation
Date Sun, 03 Apr 2011 14:16:04 -0400
Organization A noiseless patient Spider
Lines 23
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>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Sun, 3 Apr 2011 18:16:06 +0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="KiwfXDyOjqGhZBXcfNnZBg"; logging-data="10365"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+14iVPpojtdRtWg4GO5zLM"
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9
In-Reply-To <F5udnYlGL8ziBQXQnZ2dnUVZ_sqdnZ2d@earthlink.com>
Cancel-Lock sha1:dsrGV1O5SfBqtDGFenb9pd23rFE=
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.help:515

Show key headers only | View raw


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 | NextPrevious in thread | Find similar | Unroll thread


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