Java - Strings and String Handling
Which method should you use in Java to check if two strings have exactly the same characters and case?
String s1 = "Hello";String s2 = "hello";String s1 = "Hello";String s2 = "hello";== compares references, not content, so it is not reliable for string content comparison.equals() checks if two strings have exactly the same characters and case, which is what is asked.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions