posts - 43,comments - 75,trackbacks - 0

          import java.util.Calendar;
          import java.util.GregorianCalendar;

          /**
          ?* CalTest.java
          ?*
          ?* Version 0.1
          ?*
          ?* Created 2006-6-9? 16:29:22
          ?*
          ?*? TODO
          ?*/

          public class CalTest
          {

          ?/**
          ? * 得到本月的最后一天;
          ? * @return
          ? */
          ?public static int getLastDayOfMonth(){
          ??int intDay? = 0;
          ??GregorianCalendar cca = new GregorianCalendar();
          ??Calendar ca = cca.getInstance();
          ??intDay = cca.getActualMaximum(ca.DAY_OF_MONTH);
          ??return intDay;
          ?}
          }

          /**
          -----------------------下面是測試類-------------------------
          **/
          import junit.framework.TestCase;

          public class CalTestTest extends TestCase
          {

          ?protected void setUp() throws Exception
          ?{
          ??super.setUp();
          ?}

          ?protected void tearDown() throws Exception
          ?{
          ??super.tearDown();
          ?}

          ?/*
          ? * Test method for 'CalTest.getLastDayOfMonth()'
          ? */
          ?public void testGetLastDayOfMonth()
          ?{
          ??int intDay = CalTest.getLastDayOfMonth();
          ??System.out.println(intDay);
          ?}

          }


          posted on 2006-06-09 16:51 夢源 閱讀(532) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 桓台县| 泸水县| 商南县| 临沂市| 淮滨县| 年辖:市辖区| 察哈| 塔河县| 瑞金市| 兰溪市| 龙井市| 无棣县| 宁远县| 青州市| 闵行区| 湖州市| 藁城市| 昭觉县| 龙口市| 离岛区| 兴义市| 广昌县| 科技| 廉江市| 通辽市| 应城市| 霍林郭勒市| 高淳县| 禹州市| 乐亭县| 偃师市| 台江县| 新河县| 瑞金市| 新兴县| 柳江县| 綦江县| 平舆县| 漯河市| 同江市| 内丘县|