What is different type of indexOf() method in String java example
What is different type of indexOf() method in String java example
public class Test {
public static void main(String[] args) {
String st = new String("test string test here");
int index = st.indexOf((int)'t');
System.out.println(index);
index = st.indexOf((int)'t', 5);
System.out.println(index);
index = st.indexOf("test");
System.out.println(index);
index = st.indexOf("test", 10);
System.out.println(index);
}
}
public class Test {
public static void main(String[] args) {
String st = new String("test string test here");
int index = st.indexOf((int)'t');
System.out.println(index);
index = st.indexOf((int)'t', 5);
System.out.println(index);
index = st.indexOf("test");
System.out.println(index);
index = st.indexOf("test", 10);
System.out.println(index);
}
}
Comments
Post a Comment