It is unclear exactly what the context is here but ...
> > Every book on Java says that calls to this() and super() are
> > explicitly the first thing that happens in a constructor.
For most intents and purposes they are. There is one thing that happens just
before - evaluation of the arguments to this(...) or super(...) - which
provides a handy hook for allowing a static helper to verify arguments
before passing them to the super constructor.
> Jep, but I didn't initizialized them in the constructor but in the class
> body. ...
> But the allowed syntax suggest a different semantic because these kind
> of fields are independent of the constructor.
Every initializer block and initialization statement is executed in the
order they appear in the class, at the start of the actual body of the
current classes constructor (after super() has occurred. It is as if the
compiler collected all the statements into a method called init() and then
inserted a call to init() after the call to super(...).
That is the way it is defined and always has been defined. Suggesting it
could/should be done differently is pointless - that just ain't gonna
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel
This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:01:09 EDT