Loops 如何将charCount集成到for循环中
因此,我的任务是使用for循环计算给定字符串中的每个f,然后输出总和。这是我的尝试,但我不知道这个错误代码是什么意思。[1] 提前谢谢Loops 如何将charCount集成到for循环中,loops,Loops,因此,我的任务是使用for循环计算给定字符串中的每个f,然后输出总和。这是我的尝试,但我不知道这个错误代码是什么意思。[1] 提前谢谢 String string = "Schiffe für den Fischfang."; int result4 = 0; for (int stelle = 1; stelle <= string.length(); stelle++) { if (strin
String string = "Schiffe für den Fischfang.";
int result4 = 0;
for (int stelle = 1; stelle <= string.length(); stelle++) {
if (string.charAt(stelle) == 102) {
result4++;
}
}
System.out.println(result4); ```
[1]: https://i.stack.imgur.com/0wSrs.png
请添加语言标记。