统计字符串中每个字母的个数 思路: 从文件中读取字符串的内容,以字母为键(key),出现次数为值(value)存入HashMap集合中,在读入时判断集合是否存在当前字符的key,不存在则作为键值对存入集合,若存在说明出现过,value值+1,键值对覆盖存入集合中。 public class WorkDemo1 { public static void main(String[] args) { try { Map<Integer,Integer> result=new TreeMap<