DEV Community

Lakshya Tyagi
Lakshya Tyagi

Posted on

Which among them is used to create an object?

Write your answer in comment

1. A class 2. A function 3. A method 4. A constructor 
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
sp96296 profile image
Evan H

A constructor is a method of a class that allows new objects to be made.

Collapse
 
varaprasad_gudi profile image
Gudi Varaprasad

A constructor.

The values assigned by the constructor to the class variables is used in creating an object.