Is the constructor method executed upon initializing? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Is the constructor method executed upon initializing?

2nd Apr 2016, 4:06 AM
Cadell Van Den Heuvel
Cadell Van Den Heuvel - avatar
2 Answers
+ 1
No, constructor is called only when object is created
8th Apr 2016, 9:17 AM
Akshay Patharkar
Akshay Patharkar - avatar
0
constructor's main goal is to create a memory for object in RAM, then initiate it with a value and then give it a name so that we can say that an object is created.
19th Aug 2016, 7:56 AM
Shan Ur Raheem
Shan Ur Raheem - avatar