67,512
社区成员
发帖
与我相关
我的任务
分享
public class test {
public static void main(String[] args) {
String str = "fffffff";
int count = 0;
for(int i =0;i<str.length();i++) {
if(str.substring(i, i+1).equals("f")) {
count++;
if(count == str.length())
System.out.println("字符串中字符都是f");
}
else
System.out.println("不是预期的结果");
}