Multiple choice

Which of the following methods of String class searches for the first occurrence of a character or substring?

  1. indexOf()

  2. lastIndexOf()

  3. compareTo()

  4. none of these

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

This method of String class searches for the first occurrence of a character or substring.