Multiple choice

The method '_______' searches for the first occurrence of a character or substring.

  1. Index Of

  2. Search

  3. Find

  4. Locate

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

The indexOf() method in Java searches for the first occurrence of a specified character or substring within a string and returns its position. If the character or substring is not found, it returns -1, making it the standard method for position-based searches.