@Override
public int compare(Teacher t1, Teacher t2) {
int sum= t1.getName().compareTo(t2.getName());
int sum1 = sum==0?t1.getAge()-t2.getAge():sum;
return sum1;
}
});
Teacher t1 = new Teacher("张财",22);
Teacher t2 = new Teacher("张圣",24);
Teacher t3 = new Teacher("魏冰",24);
Teacher t4 = new Teacher("张生",48);
Teacher t5 = new Teacher("刘",46);