Advertisements
Advertisements
प्रश्न
Which of the following String methods returns a negative value?
पर्याय
length()equals()compareTo()charAt()
MCQ
Advertisements
उत्तर
compareTo()
Explanation:
compareTo() returns an int: a negative value if the first string is lexicographically less than the second, zero if they are equal, and a positive value if it is greater. For example, "COMPUTER".compareTo("SCIENCE") yields a negative result because 'C'comes before'S' in character order.
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2025-2026 (March) Official Board Paper
