Login
Remember
Register
Ask a Question
How many types of constructors are used in Java?
0
votes
asked
Jun 1, 2022
in
JAVA
by
SakshiSharma
How many types of constructors are used in Java?
java-constructors
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Jun 1, 2022
by
SakshiSharma
There are two types of constructors that are used in Java.
Parameterized Constructors: Parameterized constructor accepts the parameters with which users can initialize the instance variables. Users can initialize the class variables dynamically at the time of instantiating the class.
Default constructors: This type doesn’t accept any parameters; rather, it instantiates the class variables with their default values. It is used mainly for object creation.
...