Computer Applications
State the purpose and return data type of indexOf() function.
Java String Handling
ICSE 2010
32 Likes
Answer
It returns the index within the string of the first occurrence of the specified character or -1 if the character is not present. Its return type is int.
Answered By
23 Likes
Related Questions
Differentiate between charAt() and substring()
What is exception? Name two exception handling blocks.
State the purpose and return data type of compareTo() function.
Write a statement for each to perform the following task on a string:
Extract the second last character of a word stored in the variable wd.