Science, asked by PrakritiAwasthi, 2 months ago

What are constructors?


Please everyone send the report of irrelevant questions to brainly general.
If everyone report this problem, they
definitely look into this.​

Attachments:

Answers

Answered by ILOVEFRIDAY
4

Answer:

constructor (abbreviation: ctor) is a special type of subroutine called to create an object. It prepares the new object for use, often accepting arguments that the constructor uses to set required member variables.

hope it helps you ♥️

Answered by rahulranjan2725
0

A constructor in Java is similar to a method that is invoked when an object of the class is created. Unlike Java methods, a constructor has the same name as that of the class and does not have any return type. For example, class Test { Test() { // constructor body } }

Similar questions