我在main中修改了一下,您看行不?
public static void main(String[] args) {
TreeMap<String, Student[]> classes = new TreeMap<String, Student[]>();
classes.put("Base", new Student[] { new Student("LiSi", 22),
new Student("ZhanSan", 18) });
classes.put("Adv", new Student[] { new Student("ZhaoLiu", 22),
new Student("Wangwu", 25) });
Set<Map.Entry<String, Student[]>> es = classes.entrySet();
for (Iterator<Map.Entry<String, Student[]>> it = es.iterator(); it.hasNext();) {
Map.Entry<String, Student[]> me = it.next();
String name = me.getKey();
Student[] values = me.getValue();
if (1 == values.length) {
System.out.println(values[0]);
} else {
for (int i = 0; i < values.length; i++) {
System.out.println(values);
}
}