We are here to help you learn! Feel free to leave your comments and suggestions in the comment section. If you have any doubts, use the search box on the right to find answers. Thank you! 😊
str1 == str2 ? "+(str1==str2)); this will compare the references of the object of str1 and str2(note 1:when object is created with string literal it will get stored in the constant pool region of the heap segment.. note 2:when object is created with new keyword it will get stored in the Non-constant pool region of the heap segment.. note3: constant pool region doesnot allow duplicates of objects note 4:non-constant pool region allows duplicates)
Explain any one.
ReplyDelete4th program.
please...
one is stored in heap and other is stored in class memory.so if we compare it is not true.if we use ëqualstoignorecase" it will be true
Delete== operator check only reference and equals method check content
Deletestr1 == str2 ? "+(str1==str2));
ReplyDeletethis will compare the references of the object of str1 and str2(note 1:when object is created with string literal it will get stored in the constant pool region of the heap segment..
note 2:when object is created with new keyword it will get stored in the Non-constant pool region of the heap segment..
note3: constant pool region doesnot allow duplicates of objects
note 4:non-constant pool region allows duplicates)