Mam says if I declare String str = “hello”; and String str1 = “hello”; in order to first one str refers to the intern pool and checked whether the value “hello” present or not initially it wasn’t but once hello allocate in the intern pool after that when str1 has declared with the same value it refers to the same address, <---- this part I claimed wrong, because in order to refer same memory address with the same value we need to declare by —> String. intern() <— function
if,
String str = “hello”;
String str1 = str.intern(); was retuen then it should work ,
I am very sorry if I was wrong , basically this was my doubt please resolve