Qus:    How many types of constructors are used in Java?
May 13, 2022 16:35 Java 1 Answers Views: 987 nitemaleca08
Prev Next
Answers (1)
saritha Feb 15, 2021 15:01
Answer:   Based on the parameters passed in the constructors, there are two types of constructors in Java.
o Default Constructor: default constructor is the one which does not accept any value. The default constructor is mainly used to initialize the instance variable with the default values. It can also be used for performing some useful task on object creation. A default constructor is invoked implicitly by the compiler if there is no constructor defined in the class.
o Parameterized Constructor: The parameterized constructor is the one which can initialize the instance variables with the given values. In other words, we can say that the constructors which can accept the arguments are called parameterized constructors.

Post Your Answer
Guest User

Not sure what solution is right for you?

Choose the right one for you.
Get the help of the experts and find a solution that best suits your needs.


Let`s Connect