+ 1

Explain the usage of hello while creating the object in the below code?

https://code.sololearn.com/cHwm366PlmVo

26th Dec 2019, 10:26 AM
Nagaraj P
Nagaraj P - avatar
6 Réponses
+ 5
Nagaraj P [ Inactive ] We create the object of the class using new keyword so here in this code we have created a object of the reference class Hello. By using that object we are printing the value.
26th Dec 2019, 10:56 AM
A͢J
A͢J - avatar
+ 3
The Hello on LHS is the reference and the Hello on RHS is a constructor call. It means that your object is of Hello type and it needs to make a call to the constructor for the object to get created of that class.
26th Dec 2019, 10:30 AM
Avinesh
Avinesh - avatar
+ 3
🅰🅹 - ɪ'ᴍ ᴄʀɪᴍɪɴᴀʟʟʏ ɢᴏᴏᴅ! Thank you so much Brother. ❤️🌟
26th Dec 2019, 11:35 AM
Nagaraj P
Nagaraj P - avatar
+ 3
Avinesh thank you brother understood that thing...🌟
26th Dec 2019, 11:36 AM
Nagaraj P
Nagaraj P - avatar
+ 2
Your object is of the reference type so it helps in accessing the members of the class of which the reference has been created.
26th Dec 2019, 11:14 AM
Avinesh
Avinesh - avatar
+ 1
Avinesh Thank you but again a question How the reference (Hello on LHS) works along with the object...
26th Dec 2019, 10:42 AM
Nagaraj P
Nagaraj P - avatar