无为

无为则可为,无为则至深!

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  190 Posts :: 291 Stories :: 258 Comments :: 0 Trackbacks

 import java.util.Calendar;

import java.util.GregorianCalendar;

public class CalTest {

public static void main(String[] argv) {

CalTest calTest = new CalTest();

calTest.cal(2009, 11);

}

public void cal(final int year, final int month) {

Calendar calendar = new GregorianCalendar();

calendar.set(year, month-1, 1);

int week = calendar.get(GregorianCalendar.DAY_OF_WEEK) - 1;

int days = calendar.getActualMaximum(GregorianCalendar.DAY_OF_MONTH);

System.out.println();

System.out.println("日\t一\t二\t三\t四\t五\t六");

for(int i = 0; i < week; i++) {

System.out.println("\t");

}

for(int i = 1; i <= days; i ++) {

System.out.print(i + "\t");

if((week + i)%7 == 0) {

System.out.println();

}

}

}


}


运行效果:




凡是有该标志的文章,都是该blog博主Caoer(草儿)原创,凡是索引、收藏
、转载请注明来处和原文作者。非常感谢。

posted on 2009-11-06 20:49 草儿 阅读(752) 评论(2)  编辑  收藏 所属分类: JAVA WEB应用

Feedback

# re: Calender 2009-12-31 05:05 EllenbY22
I guess that now men need <a href="http://www.primewritings.com">custom essay plus</a> about this good topic, because this is our business to supply you with the fantastic information connecting with <a href="http://www.primewritings.com/costs.php">costs</a>.   回复  更多评论
  


只有注册用户登录后才能发表评论。


网站导航: