+ 2
What happened when we declared class obj??
Let's consider player is defined. Now we declare Player mario ; What will happen if we don't declare Player mario = new player (); Someone please explain.
2 odpowiedzi
+ 4
I am not sure, but I think a new section or amount of memory is needed to store an object.And the new keyword allocates that memory for the object.
+ 1
I mean, you can just try it. It throws an error.
https://code.sololearn.com/cVkPYU5vjhEg/?ref=app
You can't use an object if you have never made one, the variable itself is just a placeholder until you assign an object to it.