declaration and instantiation :-
Test test - declares the reference variable.
new Test() - using
new operator makes a call to the construtor and creates an object.
Test test = new Test(); - puts the object reference in the reference variable
test
----------------------------------------
Now if i create another reference variable :-
test2 - this is another reference variable. My question is, does
test2 pointing to the same object created before or poiting to another newly created pointer just now.
Don't you think that there is only 1 object of a class but we are creating multiple reference variables for that same object only, any contradiction,if yes ?
please clear my doubt with some examples.