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

ICSE Class 10 Computer Applications PYQ · 2024 Specimen · Section A

1(xvi)1 Mark · 2024 · Section A · 2024 Specimen

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

Show SolutionHide Solution↓

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.

← Previous questionNext question →

Browse the free Computer Applications sample bank