Its better known that strings are immutable
=> meaning, that the contents of the object cannot be changed after it is created
.
So, the interview question was:
How many objects were created in this statement?
string q = "A" + "B" + "C";
I answered two
because "A" + "B" creates one object and concatenating with "C" creates an another one.
But, she said its wrong
. Any ideas why ?
And what happens when concatenation of multiple strings take place like in this scenario ?