264,966 views
41 votes
41 votes
What method is known as a class's constructor, because it is run automatically when a user instantiates the class

User Stevenn
by
2.4k points

1 Answer

17 votes
17 votes

A constructor is a special method of a class or structure in object-oriented programming that initializes a newly created object of that type. ... Instead of performing a task by executing code, the constructor initializes the object, and it cannot be static, final, abstract, and synchronized.

User Jeyhun Karimov
by
2.3k points