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)源 閱讀(529)
評(píng)論(0) 編輯 收藏