If str1 and str2 are both Strings, which of the following expressions will correctly determine whether they are equal?
(1) (str1 == str2)
(2) str1.equals(str2)
(3) (str1.compareTo(str2) == 0)
A) 1, 2, and 3 will all work
B) 1 and 2
C) 1 and 3
D) 2 and 3
Correct Answer:
Verified
Q14: A local variable's scope always ends at
Q49: An important style rule you should follow
Q50: What will be printed when the following
Q51: What would be the value of discountRate
Q52: The if/else statement will execute one group
Q53: What will be the value of charges
Q55: Because the || operator performs short-circuit evaluation,
Q56: When two Strings are compared using the
Q57: What does the following code display?
Double x
Q58: What will be printed when the following
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents