I get a compilation error stating cannot reference x before supertype constructor has been called.. Do i get this error just because it is specified in the JLS that instance variables cannot be referenced in constructor before call to super?
I am not able to understand this, because any way x is initialised to 5 before we make a call to super constructor. Am I missing something silly.. Regards, Joshua
The superclass will be initialized before the subclass. If x were to be resolved to 5 and sent to the constructor of the superclass, then the subclass would have to be initialized before the superclass.
It sounds like you had a problem with either the command line or CLASSPATH. [ June 21, 2006: Message edited by: Keith Lynn ]
Joined: Jun 06, 2006
Hi Keith, I am sorry for my last post actually yesterday I downloaded the enthuware database so for that I made some changes in my classpath and I forgot to include the current directory in it. So, that's why it was giving error...Sorry for your inconvenience
Everything is working fine now...including Joshua's code