I referred to a few posts on Stackoverflow and other sites about Java string pool.
So, when we do:
String s1 = "Emilia";
It creates a string object in the string pool. [Assumming we started from an empty string pool]
Now when we do,
String s2 = "Emilia";
How does java assign the same object reference to s2 also?
Does it iterate through all the string pool objects and compare the value? I suppose there should be a better approach for this.