meaning of this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

meaning of this code

Dog d = new Dog();

10th Aug 2019, 6:32 AM
Ratnesh Tiwari
Ratnesh Tiwari - avatar
1 Answer
0
Declare a variable <d>, this variable will be an instance of class `Dog`. Once memory is allocated (in heap), the `new` operator invokes the `Dog` class constructor in order to initialize the instance. P.S. I believe it is covered in lesson, maybe explain which part of it exactly that you didn't understand? Hth, cmiiw
10th Aug 2019, 7:18 AM
Ipang