What is constructor overloading?
Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.
What is constructor overloading?
Rating:
Constructor overloading is a technique in Java in which a class can have any number of constructors that differ in parameter lists. A constructor uses its arguments to initialize the new object's state. The compiler differentiates these constructors by taking into account the number of parameters in the list and their types.
As constructors are not members of a class, they are not inherited by subclasses. Therefore, each of the subclasses must specifically implement any constructors it needs. However, a subclass can use the constructors of its superclass by using the super keyword.
Rating:
Was this information helpful?
Other articles
- What is the ceiling() method of the NavigableSet interface?
- What is the descendingIterator() method of the NavigableSet interface?
- What is the File class?
- What is the headMap() method of the NavigableMap interface?
- New features in SCJP exam