怎么样写个日历啊?????? 想写个java日历 要怎么样的思路啊 还有那个每个月一号前面那个几个是怎么空出来的啊??? 怎么区判断那月那天是星期几??? 各位牛人就给我个思路就好了 没有一点头绪啊我 不知道该怎么样区判断那些东西 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import java.io.*;class putout{public void putout(int f,int x,int y){int i;int a[]= new int[40]; System.out.println(" 日 一 二 三 四 五 六 "+" "+f+"月");for (i=0;i<x;i++){System.out.print(" "); }for(i=x;i<x+y;i++)a[i]=i-x+1;for(i=x;i<x+y;i++){if ((i%7==0)&&(i>0))System.out.print("\n");if (a[i]<10)System.out.print(" "+a[i]);else System.out.print(" "+a[i]);}System.out.println("\n");}}class st{public static void main(String args[])throws IOException{putout p=new putout();int year,mouth,y=1,t,i;InputStreamReader ir;BufferedReader in;ir=new InputStreamReader(System.in);in=new BufferedReader(ir);System.out.print("请输入一个年份:");String s=in.readLine();year=Integer.parseInt(s);if((year%4==0 && year%100!=0)||(year%400==0))mouth=1;else mouth=0;y=year;for(i=1;i<year;i++){if((i%4==0 && i%100!=0)||(i%400==0))y++;}y=y%7;for(i=1;i<13;i++){switch(i){case 1: {p.putout(1,y,31);y=(y+31)%7;break;}case 2: {p.putout(2,y,28+mouth);y=(y+28+mouth)%7;break;}case 3: {p.putout(3,y,31);y=(y+31)%7;break;}case 4: {p.putout(4,y,30);y=(y+30)%7;break;}case 5: {p.putout(5,y,31);y=(y+31)%7;break;}case 6: {p.putout(6,y,30);y=(y+30)%7;break;}case 7: {p.putout(7,y,31);y=(y+31)%7;break;}case 8: {p.putout(8,y,31);y=(y+31)%7;break;}case 9: {p.putout(9,y,30);y=(y+30)%7;break;}case 10: {p.putout(10,y,31);y=(y+31)%7;break;}case 11: {p.putout(11,y,30);y=(y+30)%7;break;}case 12: {p.putout(12,y,31);y=(y+31)%7;break;}}}}} 面试题:new的三个动作是什么 java线程池的用法 想得分的进,答得好可以加分 网络编程中的Charset问题 不同数据类型写到文件中的区别 menuitem的事件是怎么加入的啊? !!!!!!ms sql怎么写取出一些连续的记录?参与有分!!!!!!!!!!!!!!!!!! 为什么从java.sql.ResultSet中派生新类出现错误? 急:jb6/7用design做Jtable为什么出不来东西呢? 焦急救援 Table 的 滚动条 Java在美国很火是事实,它到底火在哪?! 学校JAVA大赛项目问题 关于程序执行
class putout{
public void putout(int f,int x,int y){
int i;
int a[]= new int[40];
System.out.println(" 日 一 二 三 四 五 六 "+" "+f+"月");
for (i=0;i<x;i++)
{System.out.print(" "); }
for(i=x;i<x+y;i++)
a[i]=i-x+1;
for(i=x;i<x+y;i++)
{
if ((i%7==0)&&(i>0))
System.out.print("\n");
if (a[i]<10)
System.out.print(" "+a[i]);
else System.out.print(" "+a[i]);
}
System.out.println("\n");
}
}class st{
public static void main(String args[])throws IOException{
putout p=new putout();
int year,mouth,y=1,t,i;
InputStreamReader ir;
BufferedReader in;
ir=new InputStreamReader(System.in);
in=new BufferedReader(ir);
System.out.print("请输入一个年份:");
String s=in.readLine();
year=Integer.parseInt(s);
if((year%4==0 && year%100!=0)||(year%400==0))
mouth=1;
else
mouth=0;
y=year;
for(i=1;i<year;i++)
{if((i%4==0 && i%100!=0)||(i%400==0))
y++;}
y=y%7;
for(i=1;i<13;i++){
switch(i){
case 1: {p.putout(1,y,31);y=(y+31)%7;break;}
case 2: {p.putout(2,y,28+mouth);y=(y+28+mouth)%7;break;}
case 3: {p.putout(3,y,31);y=(y+31)%7;break;}
case 4: {p.putout(4,y,30);y=(y+30)%7;break;}
case 5: {p.putout(5,y,31);y=(y+31)%7;break;}
case 6: {p.putout(6,y,30);y=(y+30)%7;break;}
case 7: {p.putout(7,y,31);y=(y+31)%7;break;}
case 8: {p.putout(8,y,31);y=(y+31)%7;break;}
case 9: {p.putout(9,y,30);y=(y+30)%7;break;}
case 10: {p.putout(10,y,31);y=(y+31)%7;break;}
case 11: {p.putout(11,y,30);y=(y+30)%7;break;}
case 12: {p.putout(12,y,31);y=(y+31)%7;break;}
}
}
}
}