Delphi中Enum在Java 1.4实现

十年热恋 提交于 2019-11-27 04:08:11
delphi代码:

DayType =(dtWorking,dtWeekend,dtHoliday);

  MyCalendar = class
  private
          function GetCurrentDayType:DayType ;
  public
          property CurrentDayType:DayType read GetCurrentDayType;
  end;

function MyCalendar.GetCurrentDayType:DayType;
begin
    result := dtWorking;
end;

java代码:

 1ExpandedBlockStart.gifContractedBlock.giffinal class DayType dot.gif{
 2InBlock.gif
 3InBlock.gif    public static final DayType WORKING = new DayType();
 4InBlock.gif
 5InBlock.gif    public static final DayType WEEKEND = new DayType();
 6InBlock.gif
 7InBlock.gif    public static final DayType HOLIDAY = new DayType();
 8ExpandedBlockEnd.gif}

 9None.gif
10ExpandedBlockStart.gifContractedBlock.gifpublic class MyCalendar dot.gif{
11InBlock.gif
12ExpandedSubBlockStart.gifContractedSubBlock.gif    public DayType getDayType() dot.gif{
13InBlock.gif        return DayType.WEEKEND;
14ExpandedSubBlockEnd.gif    }

15InBlock.gif
16ExpandedBlockEnd.gif}

17None.gif

转载于:https://www.cnblogs.com/jssy/archive/2006/05/24/408390.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!