What does the String method indexOf( char c ) return if the character parameter is not in the string?
a) ArrayOutOfBoundsException
b) -1
c) 0
d) null
http://docs.oracle.com/javase/7/docs/api/java/lang...
Wouldn't it have been easier and faster to look at the reference?
http://docs.oracle.com/javase/6/docs/api/java/lang...
Returns:
the index of the first occurrence of the character in the character sequence represented by this object, or -1 if the character does not occur.
-1
Comments
b) -1
http://docs.oracle.com/javase/7/docs/api/java/lang...
Wouldn't it have been easier and faster to look at the reference?
http://docs.oracle.com/javase/6/docs/api/java/lang...
Returns:
the index of the first occurrence of the character in the character sequence represented by this object, or -1 if the character does not occur.
-1