I could not find any threads containing information about why the indexOf method allows for different parameters other than an integer.
I tried to check in the javados to see if there was a method with the same name but different parameters but I couldn't find any that allowed an input of characters here: https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#indexOf-int-
However, reading the indexOf method with the int as a parameter I get that:
If a character with value ch occurs in the character sequence represented by this String object, then the index (in Unicode code units) of the first such occurrence is returned.
How is this possible though, I thought that you could only return a type that is the same as the method?
-1if there is no match). The result is anint(thecount).