+ 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 Respuestas
+ 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