public class StringIndex {
public static void main(String args[]){
String str = "jsp servlet tutorial";
int a = str.indexOf('h');
System.out.println("Index of 'h' in String 'str' is: " + a);
System.out.println("Index of 's' in String 'str' is: " + str.indexOf("s"));
System.out.println("Index of 'servlet' in String 'str' is: " + str.indexOf("servlet"));
}
}