What is constructor overloading? Give examples.
Answers
Answered by
5
Having two or more constructors with the same object name and same signatures within the same class is called Constructor overloading. Sometimes there is a need of initializing an object in different ways. This can be done using constructor overloading. For example, Thread class has 8 types of constructors.
Answered by
5
Answer:
In Java constructor just like a method but without return type. It can also be overloaded like Java methods.
constructor overloading in Java is a technique of having more than one constructor with different parameter list they are arranged in a way that each constructor performs the different task they are differentiated by the compiler by the number of parameters in the list and their types.
EXAMPLE.. is above the answer in pictures
hope it helps..
please mark as brainliest if u like it
Attachments:
Similar questions