java字符串统计出现次数 java如何统计字符串中每个字符出现的次数?

java如何统计字符串中每个字符出现的次数?公共类测试{public static void main(String[]args){//系统输出打印(getCharCount(c,string))}公

java如何统计字符串中每个字符出现的次数?

公共类测试{public static void main(String[]args){//系统输出打印(getCharCount(c,string))}公共静态int getCharCount(char c,string string){int count=0 for(int i=0 i<)字符串长度()i){字符温度=字符串.charAt(i) if(c==temp)count}返回count}