HolidayCalendarClient.java
资源名称:某公司的java培训教材 [点击查看]
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:1k
源码类别:
Java编程
开发平台:
Java
- package com.borland.training.meetings.clients;
- import com.borland.training.meetings.sessions.*;
- public class HolidayCalendarClient {
- public static void main(String[] args) {
- try {
- javax.naming.Context context = new javax.naming.InitialContext();
- Object object = context.lookup("meetings/HolidayCalendar");
- HolidayCalendarHome holidayCalendarHome = (HolidayCalendarHome)
- javax.rmi.PortableRemoteObject.narrow(
- object, HolidayCalendarHome.class);
- HolidayCalendar hcal = holidayCalendarHome.create();
- if(hcal.isCompanyHoliday(new java.util.Date())) {
- System.out.println("Today is a holiday :-)");
- }
- else {
- System.out.println("Today is a working day :-(");
- }
- hcal.remove();
- }
- catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- }