I need to know whether in Java does the indexOf() method return false or void for an unfound string? or does it return an index int of 0?
It'll return -1 (hint: try it)
As in the JavaDoc
The Java API docs contain this answer. the indexOf methods on a String return -1 if the character is not found.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With