2个回答
展开全部
public coid getDateSx(){
Calendar cal = Calendar.getInstance();
int hour = cal.get(Calendar.HOUR_OF_DAY);
if (hour >= 6 && hour < 8) {
out.print("早上好");
} else if (hour >= 8 && hour < 11) {
out.print("上午好");
} else if (hour >= 11 && hour < 13) {
out.print("中午好");
} else if (hour >= 13 && hour < 18) {
out.print("下午好");
} else {
out.print("晚上好");
}
}
Calendar cal = Calendar.getInstance();
int hour = cal.get(Calendar.HOUR_OF_DAY);
if (hour >= 6 && hour < 8) {
out.print("早上好");
} else if (hour >= 8 && hour < 11) {
out.print("上午好");
} else if (hour >= 11 && hour < 13) {
out.print("中午好");
} else if (hour >= 13 && hour < 18) {
out.print("下午好");
} else {
out.print("晚上好");
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询