[code="java"]public class string{ public static void main(String[] args){ String str="234709238sdfmklxz&^%&%^&%dsfcxznvzxcjksjdfrfioeud8q79423"; int i,j; int [] time = new int[256]; char []ch=str.toCharArray(); for (i=0;i<ch.length;i++) { j=ch[i]; time[j]++; } for (i=0;i<time.length;i++) { if (time[i]!=0){ char c=(char)i; System.out.println(c+"出现的次数为 "+time[i]); }