determining which existing string to point to on creation of new string

Viewed 24

in java if you define a string which containes a array of char that already exist it will be bount to the same refrence which i assumed it scanned the memory from bottom to top to search but on further inspection its the first string initiated with that string even if that string has a "higher" adress so i wondered how the java interperter searches for existing strings i checked the variable's adress using

System.identityHashCode()

and used a basic string for testing like "hello"

0 Answers
Related