0 votes
in JAVA by

What’s the use of default constructor?

1 Answer

0 votes
by

What’s the use of default constructor?

The default constructor is a constructor that gets called as soon as the object of a class is declared. The default constructor is un-parametrized. The generic use of default constructors is in the initialization of class variables.

class ABC{ 

    int i,j; 

    ABC(){ 

        i=0; 

        j=0; 

    } 

Here ABC() is a default constructor.

Related questions

+1 vote
asked May 12, 2021 in JAVA by rajeshsharma
0 votes
asked Dec 16, 2020 in JAVA by SakshiSharma
...