F ff_ff Unregistered / Unconfirmed GUEST, unregistred user! 2006-03-14 #1 在java的控制台下输入年份,打印该年的年历 公历一年一月一日是星期一 朋友给分析分析.
黑 黑星星 Unregistered / Unconfirmed GUEST, unregistred user! 2006-03-14 #2 一年有365.2425天, 每年1月1日星期 (365.2425*年份) mod 7 = (1.2425*年份) mod 7 结果取整, 0代表星期天,1~6代表星期一~星期六 不过碰到被400整除的年份,结果要减1
一年有365.2425天, 每年1月1日星期 (365.2425*年份) mod 7 = (1.2425*年份) mod 7 结果取整, 0代表星期天,1~6代表星期一~星期六 不过碰到被400整除的年份,结果要减1
F ff_ff Unregistered / Unconfirmed GUEST, unregistred user! 2006-03-14 #3 public static int getWeek(int year) { int week=0; if (year%400==0) { year=year-1; week = int((1.2425 * year) % 7 ); } else { week = int((1.2425 * year) % 7 ); } return week; } 错误: .class expected week = int((1.2425 * year) % 7 );出错
public static int getWeek(int year) { int week=0; if (year%400==0) { year=year-1; week = int((1.2425 * year) % 7 ); } else { week = int((1.2425 * year) % 7 ); } return week; } 错误: .class expected week = int((1.2425 * year) % 7 );出错
F ff_ff Unregistered / Unconfirmed GUEST, unregistred user! 2006-03-14 #4 week = (int)((1.2425 * year) % 7 ); 汗