Hi everybody, I want to know whether Constructors can be called other than when a class is instantiated? Also can methods or classes be static and abstract at the same time?
No methods and classes cannot be abstract ans static, that is not allowed. There is now way to call a constructor from any other class directly, only subclass we can use super(); otherwise only way to call the constructor is by using new(); can anyone else also clarify? [This message has been edited by Milind Deodhar (edited December 07, 2000).]
You are correct Milind. Constructors are only called when the class is initialized and you can call another constructor within a constructor with the call this() and you can call the constructor of the immediate super class with super. One thing they try to trick you on is whether you can call a specific constructor of your superclass's superclass like super().super() or something like that, but there is no way you can call further up the hieracrhy other than the superclass. Also if you use this() or super() they need to be the first call in the constructor, therefore you can't use super and this in the same constructor. You are also correct about abstract and static. Bill
Willie Smits can speak 40 languages. This tiny ad can speak only one: