aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • Java Strings
  • Which of the following data types can be passed as the fi...
Multiple choice

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

  1. Char

  2. String

  3. Int

  4. Both 1 and 2

  5. All of the above

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

As I explained both char and string can be passed as the first parameter to the lastIndexOf() method.So this is the correct answer.

Keep practicing — related questions

  • String s = “Welcome To Java” s.lastIndexOf(“Java”,5); What is the result of the given code?
  • String s = “Welcome To Java” s.lastIndexOf(“Java”,5); What is the result of the given statements?
  • Which of the following methods in string class of java searches for the last occurrence of a character or s...
  • Which of the following methods of String class searches for the first occurrence of a character or substring?
  • What is the result of the given statements? String s = “Welcome To Java” s.lastIndexOf(“Java”,5);
  • Which of the following searches for the first occurrence of a character or substring?
  • Which of the following string manipulation methods returns index position of first occurrence of characters...
  • The _______________ method searches for the first occurrence of a character or substring.
Play the full quiz 🎤 Practise this topic out loud

Practice this topic

  • Programming Fundamentals (2381 questions)
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy