The indexOf(String str) method is utilized to return the index of the sub-string which occurs first in the string stated.
Method Definition: indexOf(String str)
Return Type: It returns the index of the sub-string which is specified in the argument of the method.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.