+1 vote
in JAVA by

What is Constructor in Java?

1 Answer

0 votes
by

A constructor is a special method whose task is to initialize the object of its class.

It is special because its name is the same as the class name.

They do not have return types, not even void and therefore they cannot return values.

They cannot be inherited, though a derived class can call the base class constructor.

Constructor is invoked whenever an object of its associated class is created.

Related questions

+1 vote
asked Jan 24, 2020 in JAVA by rahuljain1
0 votes
asked Oct 27, 2020 in JAVA by sharadyadav1986
...