将读取的字符串遍历截取
import java.util.LinkedHashMap;
import java.util.Map;
public class AddUpCharacter {
public static void main(String[] args) {
Map
for (char c : map.keySet()) {
System.out.println(c + " : " + map.get(c));
}
}
public static Map
Map
for (char c : source.toCharArray()) {
if (!map.containsKey(c)) {
map.put(c, 0);
}
map.put(c, map.get(c) + 1);
}
return map;
}
}