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
43 Likes
Answer
- 2 + 10 = 12
- ASCII Code of B - ASCII Code of D
⇒ 66 - 68
⇒ -2
Answered By
20 Likes
Related Questions
Define a class to accept a string and convert the same to uppercase, create and display the new string by replacing each vowel by immediate next character and every consonant by the previous character. The other characters remain the same.
Example:
Input : #IMAGINATION@2024
Output : #JLBFJMBSJPM@2024The output of the statement "CONCENTRATION".indexOf('T') is:
- 9
- 7
- 6
- (-1)