indexOf() in java | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

indexOf() in java

Why in the syntax "int indexOf(int ch)" the type of ch is "int". It should be rather "char" because here we are searching for character and not an integer.

4th Jul 2018, 10:20 PM
harshit
harshit - avatar
3 Respostas
+ 1
I think for handling Unicode chars
4th Jul 2018, 11:01 PM
KrOW
KrOW - avatar
+ 1
then why in the syntax "int indexOf(String str)" type of str is String and not integer
4th Jul 2018, 11:11 PM
harshit
harshit - avatar
- 1
Becauae you want get index of a substring šŸ˜‰
4th Jul 2018, 11:18 PM
KrOW
KrOW - avatar