Given the following code, which expression displays the word "Equal"?
String s1="Java"; String s2="java"; if(expression) { System.out.println("Equal"); } else { System.out.println("Not equal"); }
a. s1==s2 b. s1.matchCase(s2) c. s1.equalsIgnoreCase(s2) d. s1.equals(s2)
c
Option a only compares equality of objects.
Option b is incorrect because there is no such method as matchCase
In option d, the equals method uses the case which is different in the two strings.