Which code snippet will always output "Yes!" when s1 and s2 are two strings the contain the same sequence of characters?
A) if (s1=s2)
{
System. out. println ("Yes!") ;
}
B) if (s1==s2)
{
System. out.println ("Yes!") ;
}
C) if (s1.equals (s2) )
{
System. out.println ("Yes!") ;
}
D) if (s1 .compareTo (s2) ==1)
{
System. out. println ("Yes!") ;
}
Correct Answer:
Verified
Q26: What is the output of the following
Q27: What is the output of the statements
Q28: Assuming that the user provides 49 as
Q29: What is the output of the following
Q30: The two strings "Aardvark" and "Aardvandermeer" are
Q32: What is the output of the following
Q33: Which if statement is true when the
Q34: Assuming that the user provides 3 as
Q35: What is the output of the following
Q36: What is the conditional required to check
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