Advertisements
Advertisements
Question
What is the output of the statement given below?
“ANGER”.compareTo(“ANGEL”)Options
3
−6
6
0
MCQ
Advertisements
Solution
6
Explanation:
Here the compareTo() compares the strings “ANGEL” and “ANGER” and gives the difference in ASCII codes of the differentiating characters ‘L’ and ‘R’.
shaalaa.com
Is there an error in this question or solution?
2024-2025 (March) Official Board
