//java.sql.Date,java.util.Date-->>存储日期数据
//SimpleDateFormat-->>字符串变日期,日期变 字符串
//SimpleDateFormat-->>字符串变日期,日期变 字符串
Calendar calendar=Calendar.getInstance();//存储当前日期
int year_now=calendar.get(Calendar.YEAR);
int month_now=calendar.get(Calendar.MONTH)+1;
int day_now=calendar.get(Calendar.DAY_OF_MONTH);
System.out.println(year_now);
System.out.println(month_now);
System.out.println(day_now);
for(Student stu:stulist){
calendar.setTime(stu.getBirthday());
int year_pass=calendar.get(Calendar.YEAR);
int month_pass=calendar.get(Calendar.MONTH)+1;
int day_pass=calendar.get(Calendar.DAY_OF_MONTH);
int age=year_now-year_pass;
if(month_now<month_pass){
age--;
}else if((month_now==month_pass)&&(day_now<day_pass))
{
age--;
}
stu.setAge(age);
}