`
- 浏览:
72563 次
- 性别:
- 来自:
厦门
-
-
-
importjava.io.BufferedReader;
-
importjava.io.IOException;
-
importjava.io.InputStreamReader;
-
importjava.util.Calendar;
-
importjava.util.GregorianCalendar;
-
publicclassCalendarTest{
-
publicstaticvoidmain(String[]args)throwsIOException{
-
BufferedReaderin=newBufferedReader(newInputStreamReader(System.in));
-
System.out.print("请输入一个年份:");
- Stringyears=in.readLine();
-
CalendarPrintercp=newCalendarPrinter(years);
- cp.printCal();
- }
- }
-
classCalendarPrinter{
-
privateintyear;
-
privatestaticfinalintmonthCount=12;
-
publicCalendarPrinter(Stringyears){
-
if(!years.matches("//d{4}")){
-
System.out.println("yearthatinputtedisillagel.");
-
return;
- }
- year=Integer.parseInt(years);
- }
-
publicvoidprintCal(){
-
-
GregorianCalendargCal=newGregorianCalendar();
-
- gCal.set(Calendar.YEAR,year);
-
for(intmonth=0;month<monthCount;month++){
- gCal.set(Calendar.MONTH,month);
- printOut(gCal);
- }
- }
-
privatevoidprintOut(Calendarcal){
-
intmonth=cal.get(Calendar.MONTH);
-
-
cal.set(Calendar.DAY_OF_MONTH,1);
-
intweekday=cal.get(Calendar.DAY_OF_WEEK);
-
-
System.out.println("SunMonTueWedThuFriSat");
-
-
for(inti=Calendar.SUNDAY;i<weekday;i++)
-
System.out.print("");
-
do{
-
-
intday=cal.get(Calendar.DAY_OF_MONTH);
-
if(day>0)
-
System.out.print(""+day+"");
-
else
-
System.out.print(""+day+"");
-
-
if(weekday==Calendar.SATURDAY)
- System.out.println();
-
-
cal.add(Calendar.DAY_OF_MONTH,1);
- weekday=cal.get(Calendar.DAY_OF_WEEK);
-
}while(cal.get(Calendar.MONTH)==month);
-
-
-
if(weekday!=Calendar.SUNDAY)
- System.out.println();
- }
- }
分享到:
Global site tag (gtag.js) - Google Analytics
相关推荐
主要介绍了python使用calendar输出指定年份全年日历的方法,涉及Python使用calendar模块操作日期的技巧,非常具有实用价值,需要的朋友可以参考下
主要介绍了Java 使用Calendar类输出指定年份和月份的日历,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
bootstrap calendar 全年日历显示,可做年度行事历等功能,使用起来特别方便,相关使用方法详见官网:http://www.bootstrap-year-calendar.com/#Documentation/Installation
Calendar 移动端日历插件
ext js calendar 日历ext js calendar 日历ext js calendar 日历
Calendar 仅修改界面的日历组件 delphi开发,功能较齐全
可折叠的日历控件Calendar;
版本描述 Web Calendar ver 3.0 是综合 JavaScript DHTML HTML CSS 的...对年份下拉框的年跨度值的设置 6.增加了用方向键快捷键选择年月 7.增加了日历对网页空间的自适应显示 8.对日历日期显示机制的全新设计
WebCalendar日历控件 WebCalendar日历控件
内含layui日历联动tui.calendar日程表(日、周、月)实例 相关文档: https://nhn.github.io/tui.calendar/latest/Calendar#setCalendars http://layui.itmtr.cn/doc/modules/laydate.html#use ...
js 日历控件 calendar,js 日历控件 calendar,js 日历控件 calendar,js 日历控件 calendar,js 日历控件 calendar,js 日历控件 calendar
vue-el-calendar.zip Vue -ElementUI 日历控件 以vue为承载容器,使用elementUI为组件,css3搭配色彩,样式较为美观,满足基本需求,无第三方依赖环境,体积几百K 在vue+elementUI的项目中,丢入即可运行出来
Calendar 带农历的超酷日历Calendar 带农历的超酷日历
2024年全年日历excel,A4横排,包含2024最新发布放假安排,调休日提醒,可编辑,手工制作,含节气,农历,放假安排 2024年将有七个法定放假日, 元旦:12月30日至1月1日放假3天,不调休 春节:2月10日至17日放假...
simplecalendar.js记录事件的日历插件
在原来 不得闲月历控件 基础上,由c176修改了几个Bug,2011-01-18 20:07:38 1.按方向键改变当前日期时,底栏农历日期不自动更新问题; 2.点 今天 按钮时,底栏农历日期不自动更新问题; 3.底栏农历信息增加周数... 4.... 5....
WPF Calendar 日历控件 样式自定义 粗略的在代码上做了些注释 blend 生成出来的模版 有的时候 会生成 跟 vs ui界面不兼容的代码 会导致可视化设计界面 报错崩溃掉 但是确不影响 程序的编译运行 这个样式表 在vs ...
vue-el-calendar.zip Vue -ElementUI 日历控件 以vue为承载容器,使用elementUI为组件,css3搭配色彩,样式较为美观,满足基本需求,无第三方依赖环境,体积几百K 在vue+elementUI的项目中,丢入即可运行出来
jquery calendar.js日历选择控件带节日日历选择器 jquery calendar.js日历选择控件带节日日历选择器 jquery calendar.js日历选择控件带节日日历选择器