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;
          ?}
          }

          /**
          -----------------------下面是測(cè)試類-------------------------
          **/
          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 夢(mèng)源 閱讀(533) 評(píng)論(0)  編輯  收藏

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 丽水市| 上饶县| 北海市| 丹棱县| 资溪县| 宕昌县| 武山县| 肇源县| 绥江县| 米林县| 晋州市| 安新县| 榆社县| 吉水县| 溧阳市| 启东市| 黄骅市| 化德县| 沙湾县| 信宜市| 繁昌县| 文化| 工布江达县| 姜堰市| 横山县| 保靖县| 苏尼特右旗| 正镶白旗| 东源县| 赞皇县| 汝南县| 平泉县| 青州市| 白朗县| 游戏| 深泽县| 淮安市| 莱阳市| 新乡县| 陆川县| 齐河县|