Returning to the calendar example, the last bit of the implementation is the AppointmentCalendar class, which appears in Listing 5.
返回到日历示例中,最后实现的是appointmentcalendar类,如清单5所示。
This class supports changing the date by different settings via constants in the Calendar class; for example, Calendar.WEEK_OF_MONTH to change the date one week at a time.
该类支持通过将 Calendar 类中的常数设置为不同的值来更改日期;例如, Calendar.WEEK_OF_MONTH 每次将日期更改一周。
Listing 7 demonstrates code to get a new instance of the Calendar class, obtain the hour of the day (which is returned in a 24-hour format), and then put together a simple greeting based on that hour.
清单7给出了获得calendar类新实例的代码,从而得到一天中的具体时间(以24小时的格式返回),然后根据这个时间组合出一条简单的欢迎词。
应用推荐