运行结果
public class ZiFuCiShu{
public static void main(String[] args){
System.out.println("字符\t\t 出现次数");
char[] arr={'1','4','5','6','7','0','k','j','g','a','6','7','6','5'}; //静态初始化字符数组
int count=0;
for(int i=0;i<arr.length-1;i++) {
char bb = arr[i];
for (int j = 0; j < arr.length; j++) {
if (bb == arr[j]) {
count += 1;
}
}
System.out.println("【"+arr[i]+"】----- <"+count+">");
count=0;
}
}
}