Computer Applications
Give the output of the following string functions:
- "MISSISSIPPI".indexOf('S') + "MISSISSIPPI".lastIndexOf('I')
- "CABLE".compareTo("CADET")
Java
Java String Handling
ICSE 2016
44 Likes
Answer
- 2 + 10 = 12
- ASCII Code of B - ASCII Code of D
⇒ 66 - 68
⇒ -2
Answered By
21 Likes
Related Questions
Which of the following returns a String?
- length()
- charAt(int)
- replace(char, char)
- indexOf(String)
Write a Java program to enter any sentence and convert the sentence to uppercase. Print only those words of the sentence whose first and last letters are the same.
The output of the statement "talent".compareTo("genius") is:
- 11
- –11
- 0
- 13