总结:
没有理解方法的含义、瞎用
package com.mmm; //实现字符串中某个字符出现的次数 public class Mo { public static void main(String[] args) { int count = 0; String s = "fjsdkdddlfjdskl"; for (int i = 0; i < s.length(); i++) { // System.out.println(s[i]);//对方法的使用还是不熟练所以总是错!!! if (s.charAt(i) == 'd') { count++; // System.out.println("你的判断是对的"); } } System.out.println("字符串d:出现的次数" + count); } } // 字符串d:出现的次数5