DEV Community

Lakshya Tyagi
Lakshya Tyagi

Posted on

2 2

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.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay