1String str = "helloslkhellodjladfjhello";
2String findStr = "hello";
3int lastIndex = 0;
4int count = 0;
5while(lastIndex != -1){
6 lastIndex = str.indexOf(findStr,lastIndex);
7 if(lastIndex != -1){
8 count ++;
9 lastIndex += findStr.length();
10 }
11}
12System.out.println(count);