public class Test {
//计算出现java的次数
public static void main(String[] args) {
String s = "sunjavahpjavaokjavajjavahahajavajavagoodjava";
int jCount=0;
for(int i=0;i<s.length();i++){
String c = s.substring(i, i+4);
if(c.equals("java")){
jCount++;
i+=3;
}
}
System.out.println(jCount);
}
}