0 votes
in JAVA by
How many types of constructors are used in Java?

1 Answer

0 votes
by

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.

Related questions

0 votes
asked Feb 9, 2021 in JAVA by SakshiSharma
0 votes
asked May 5, 2021 in JAVA by SakshiSharma
...