top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Why constructor can be overloaded but can't be override?

0 votes
586 views
Why constructor can be overloaded but can't be override?
posted Apr 13, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

0 votes

We can overload constructor to provide distinct values to each object present in the class. we cant override constructor bcz constructor is not involved in inheritance but it can be possible to call parent constructor by using super keywords.

answer Apr 14, 2016 by Veereshkumar Swamy
0 votes

Yes your observation is right you can't override a constructor, we can only overload.
The reason is that A sub class is a different class and must have its own constructor, so constructors can't be overridden.

answer Apr 14, 2016 by Salil Agrawal
Similar Questions
0 votes

By making private constructor, we can avoid instantiating class from anywhere outside and by making class final, no other class can extend it. Why is it necessary for Util class to have private constructor and final class ?

+1 vote

Why abstract class can't be instantiated i.e. Object of abstract class can't be created??

...