"the constructor is used to create the object"? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

"the constructor is used to create the object"?

"the constructor is used to create the object"? but what I believe is that the object is created first and then the constructor is called. and I also learned that the constructor dose not instantiate the objects. any help plz

20th Dec 2017, 3:43 AM
veerendra singh
veerendra singh - avatar
2 Answers
+ 5
Constructor called to initialize object not create. 1 step is memory allocation for this object (actual obj creation) 2 constructor runs, since you could set some values to some obj vars inside of constructir obj should exist in memory. 3 Object created if nothing went wrong. Sometimes just to skip some details you can see that people say in manner that constructor creates.
20th Dec 2017, 4:37 AM
Dima Makieiev
Dima Makieiev - avatar
+ 5
Constructor is a method which is involved in object creation
20th Dec 2017, 5:29 AM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar