Rajiv Chelsea wrote:Why cant consructors be marked final and absract?
Constructors are not methods, and that is the fundamental answer.
The term "abstract" is only relevant to the idea of "polymorphism": (run-time vs. compile-time decision making). So consider how construction works:
"Object obj = new Whatever(x, y, z);"
As you can see, at compile-time, we already know an instance of "Whatever" is created. There is no dynamism here. Which constructor to use? Well.. its the constructor for "Whatever".
Further, the fathers of
Java only want a constructor to initialize the state of an object. Set the instance variables to values that allow the object to work correctly. So, a class can say: "I need this constructor with those variables to initialize myself and be ready to rock and roll". But why would it make sense for a class to tell its subclasses which variables it needs to initialize themselves (ie. an abstract constructor)? A class knows nothing about its subclasses.
Finally, constructors are not "inherited" in the normal way people talk about inheritance because they are not methods. Constructors are "hidden" not "overrridden", by subclasses, so "final" does not make sense in a constructor. Using the "super" keyword, you do have access to public and protected constructors in your parent class.
If you could give some very specific examples of what you are asking about, that would help the discussion.