Multiple choice

Which of the following data types can be passed, as the first parameter to the lastIndexOf() method in String class?

  1. Char

  2. String

  3. Int

  4. Both the options 1 and 2

  5. All of above

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

Both char and string can be passed as the first parameter to the lastIndexOf() method. So, this is the correct answer.