Output Questions for Class 10 ICSE Computer Applications

Give the output of the following string functions:

  1. "MISSISSIPPI".indexOf('S') + "MISSISSIPPI".lastIndexOf('I')
  2. "CABLE".compareTo("CADET")

Java

Java String Handling

ICSE 2016

40 Likes

Answer

  1. 2 + 10 = 12
  2. ASCII Code of B - ASCII Code of D
    ⇒ 66 - 68
    ⇒ -2

Answered By

19 Likes