Computer Applications

What will be the output of the following program snippet?
s1 = "COMPUTER";
s2 = "computer";
System.out.println(s1.equals(s2));

  1. True
  2. False
  3. 0
  4. 1

Java String Handling

24 Likes

Answer

False

Reason — equals() method treats uppercase and lowercase characters differently. So, the two strings will not be considered equal and the boolean value 'false' will be returned.

Answered By

13 Likes


Related Questions