I am looking to see in the Java source code what happens when a variable is declared & assigned a value.
I haven't been able to spot this in java.lang.Class.
Particularly, looking to see what happens in
String s1 = "abc";
String s2 = "abc";
String is immutable and thus by the outcome of "s1 == s2", these two references-- s1 and s2 are pointing to the same object and when
String s2 = "abc";
is issued, Java is spotting the location of the object "abc" that already is created and s1 is referring to, and assigning this location to s2 (?)
I am looking to see how this is handled behind the scenes in Java.
//===========================================
EDIT:
The Q here is-- how Java is handling this in its source code.
The What is the Java string pool and how is "s" different from new String("s")? is answering this in part. I'm looking to see this all in the source code-- if it's not one of those native.
I know this a naive Q, but didn't expect these responses.