java字符串统计出现次数 java统计字符串中的字符重复的次数和和出现次数,实例?

java统计字符串中的字符重复的次数和和出现次数,实例?首先,将字符串拆分为一个数组,然后用map<string,int>,并打印public class test{public static

java统计字符串中的字符重复的次数和和出现次数,实例?

首先,将字符串拆分为一个数组,然后用map<string,int>,并打印

public class test{public static void main(string[]args){//指定字符和字符串char c=“1”string=“123456789111”系统输出打印(getCharCount(c,string))}公共静态int getCharCount(char c,string string){int count=0 for(int i=0 i<)字符串长度(一){字符温度=字符串.charAt(i) if(c==temp)count}返回count}