0
whats the difference between, "Class object = new Class(); "and just "object = new Class();" ?
Convenient way of creating an object?
1 ответ
+ 6
The former declares the object and assigns a dynamically created instance of the class to the object.
The latter does not show object declaration, and will not work unless the object has been declared somewhere before the assignment happens.
It's either
Class obj = new Class();
or
Class obj;
obj = new Class();