== operator will also work for non primitive data type but it will compare the memory of the String, if memory is different for the two strings the it will go to else part that means not equal. Am I cleared your doubt bro?
String s1 = "Java"; // "Java" is added to the string pool String s2 = s1 + s1; // s2 is a new String object in the heap with value "JavaJava" String s3 = "JavaJava"; // "JavaJava" is added to the string pool Sir, if two objects is going to Concatenation means, then it is in heap memory only at the run time for scenario #12. can you clarify sir? And if we use String s2 = (s1+s1).intern(); then it will be stored in String pool and both refers in same memory reference in string pool at the run time
Thaks Sir,Great Sesion . Never Imagined of these many scenarios in Java String. Got to know about interesting Concepts from String. Good Explanation!
really explained very well! Thank you so much
Super ah teach panringa.....👍
ungala madhuri Java va solli kudukarthuku oruthar porandhu dhan varanum
Mesmerizing...
Vera level 💯👌🔥
thank u sir
Kotlin basics videos pannunga sir plz.!
In 15.59 you have told s1 and s2 in SCP but it is in heap memory .not in SCP
Sir i have doubt you said when its primitive data type only "==" operator will work but string is non primitive how "==" this operator is working
== operator will also work for non primitive data type but it will compare the memory of the String, if memory is different for the two strings the it will go to else part that means not equal. Am I cleared your doubt bro?
String s1 = "Java"; // "Java" is added to the string pool
String s2 = s1 + s1; // s2 is a new String object in the heap with value "JavaJava"
String s3 = "JavaJava"; // "JavaJava" is added to the string pool
Sir, if two objects is going to Concatenation means, then it is in heap memory only at the run time for scenario #12.
can you clarify sir?
And if we use String s2 = (s1+s1).intern();
then it will be stored in String pool and both refers in same memory reference in string pool at the run time
Years sir heap and stack detailed information needed