InterviewSolution
Saved Bookmarks
| 1. |
What Will Happen If “==” Operator Is Used To Compare Two Strings In Java? |
|
Answer» “==” operator will COMPARE the references of the strings not the content. String str1 = "abc"; Comparing these TWO strings USING “==” operator if(str1 == str4) will RETURN FALSE as the references are different. “==” operator will compare the references of the strings not the content. String str1 = "abc"; Comparing these two strings using “==” operator if(str1 == str4) will return false as the references are different. |
|