Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Re:大哥们给我看看 [Re:pgty]
pgty





发贴: 19
积分: 0
于 2004-10-20 23:53 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
好了
应该是这样的

不过输出来的格式不对哦
import java.util.*;

public class CalendarTest
{
  public static void main(String[] args)
  {
  
    GregorianCalendar d= new GregorianCalendar();

    int today=d.get(Calendar.DAY_OF_MONTH);
    int month =d.get(Calendar.MONTH);

    d.set(Calendar.DAY_OF_MONTH,1);

    int weekday = d.get(Calendar.DAY_OF_WEEK);

    System.out.println(" Sun Mon The Wed Thu Fri Set");

    for(int i=Calendar.SUNDAY;i<weekday;i++)
      System.out.print(" ");

    do
    {
      int day = d.get(Calendar.DAY_OF_MONTH);
      if (day<10)
      {
        System.out.print(" ");
      }
      System.out.print(day);

      if (day==today)
      {
        System.out.print("* ");
      }
      else
        System.out.print(" ");
      if (weekday == Calendar.SATURDAY)
      {
        System.out.println();
      }
      d.add(Calendar.DAY_OF_WEEK,1);
    }
    while (d.get(Calendar.MONTH)==month);
    if (weekday!=Calendar.SUNDAY)
    {
      System.out.println();
    }

  }

};


pgty edited on 2004-10-20 23:57


话题树型展开
人气 标题 作者 字数 发贴时间
16094 大哥们给我看看 (打印 Calendar) pgty 1116 2004-10-20 20:24
14537 Re:大哥们给我看看 kavinwang 5 2004-10-20 20:47
14350 Re:大哥们给我看看 pgty 1981 2004-10-20 23:53
14221 Re:大哥们给我看看 () why 200 2004-10-21 08:25
14306 Re:大哥们给我看看 () pgty 222 2004-10-21 13:30
14421 Re:大哥们给我看看 () kavinwang 29 2004-10-21 18:49
14277 Re:大哥们给我看看 () pgty 80 2004-10-21 22:49
14147 Re:大哥们给我看看 () why 1263 2004-10-21 19:19
14287 Re:大哥们给我看看 (打印 Calendar) pgty 7 2004-10-21 22:48
14399 Re:大哥们给我看看 (打印 Calendar) pgty 13 2004-10-21 23:07
14361 Re:大哥们给我看看 pgty 22 2004-10-20 21:36
14469 Re:大哥们给我看看 kavinwang 8 2004-10-20 21:44
14233 Re:大哥们给我看看 helloworld 60 2004-10-20 22:00
14535 Re:大哥们给我看看 kavinwang 146 2004-10-20 22:06
14258 Re:大哥们给我看看 helloworld 13 2004-10-20 22:17
14474 Re:大哥们给我看看 pgty 81 2004-10-20 23:38
14515 Re:大哥们给我看看 kavinwang 113 2004-10-20 22:18
14477 Re:大哥们给我看看 kavinwang 46 2004-10-20 22:21
14435 Re:大哥们给我看看 kulatasana 24 2004-10-20 23:05

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923