Re: Puzzling class field initialization order

"Mann, Ivan H" <[email protected]>
Newsgroups gmane.comp.windows.devel.java.advanced
Message-ID <3E47D20FD1918B48AC434AA83B575296A04382@usplm215.amer.corp.eds.com>
Interestingly, in Eclipse, accessing c.IMPL using the newly created
object c produces an error message about ambiguous reference.  

One of the reasons for not having multiple inheritance was that the
language designers could not figure out what to do if they had two class
variables with the same name.  Looks like they figured out what to do if
one of the ambiguous names was in an interface.  I wonder why they
couldn't do the same if it was in a class.

Ivan Man




 

-----Original Message-----
From: Discussion of advanced Java topics.
[mailto:[email protected]] On Behalf Of Donald McLean
Sent: Thursday, September 06, 2007 8:58 AM
To: [email protected]
Subject: Re: [ADVANCED-JAVA] Puzzling class field initialization order

My understanding of the Java specification is that you should never
assume that any one thing will be initialized before any other thing. If
you need A to be initialized before B then it is best to do so
explicitly, like in a "static{}" block. This need may preclude declaring
something as final, but ... oh well.

Donald

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.