Which Of The Following Should Be Used To Compare The Contents Of Two String Objects In Java?
Which of the following should be used to compare the contents of two String objects in Java?
Select one:
a. =
b. ==
c. cmp
d. equals ✅
e. ?
"=" is for assignment. "==" compares the memory locations of String objects, not their contents. "cmp" is a command from Python, not Java. "?" Is the conditional operator. Use "s1.equals(s2)" to compare the contents of String "s1" and "s2".