KnowledgeBoat Logo
|

Computer Applications

The method compareTo() returns …………… when two strings are equal and in lowercase :

  1. true
  2. 0
  3. 1
  4. false

Java String Handling

ICSE Sp 2024

35 Likes

Answer

0

Reason — compareTo() method compares two strings lexicographically and returns the difference between the ASCII values of the first differing characters in the strings. Here, the strings are equal so the difference is 0.

Answered By

18 Likes


Related Questions