public class javajavavavavavjjjvasvavajava {
public static void main(String[] args) {
String str = new String("javajasdsadjjajavajavasasdsajavajava");
int i = 0;
while (str.indexOf("java") >= 0) {
i++;
str = str.substring(str.indexOf("java") + "java".length());
}
System.out.println(i);
}
}
|
|