public class Test5 {
public static void main(String[] args) {
// TODO Auto-generated method stub
LocalDate localDate=LocalDate.now();
LocalDate birDate=localDate.of(2002, 6, 27); //模拟数据库输入
MonthDay birmyDay=MonthDay.of(birDate.getMonth(), birDate.getDayOfMonth());
System.out.println("我的生日是"+birmyDay);
MonthDay nowMd=MonthDay.from(localDate);
System.out.println("今天是:"+nowMd);
boolean flog=birmyDay.equals(nowMd);//比较是否相等
if(flog) {
System.out.println("生日快乐去买蛋糕吧");
}
else {
System.out.println("不是你的生日哦别急");
}
}
}
02-27
620
01-05
917
12-19
4440
12-15
1527
09-06
994
11-19