1public class Test {
2 public static void main(String args[]) {
3 String str = new String("I81753490B9C/DQC");
4 int index = str.indexOf('DQC');
5 System.out.println("Index of the letter w :: "+index);
6 }
7}
1String str = "testdemo";
2 System.out.println("String: "+str);
3 int index = str.indexOf( 'h' );
4 System.out.printf("'h' is at index %d\n", index);