当前位置:网站首页>Calendar类的习题
Calendar类的习题
2022-07-30 05:41:00 【想买CT5的小曹】
由于Calendar是抽象类,不能实例化,所以利用子类对象进行调用方法。
package Calender_study;
import java.util.Calendar;
public class calender_t1 {
public static void main(String[] args) {
Calendar ca = Calendar.getInstance();
Calendar_print(ca);
}
public static void Calendar_print(Calendar ca) {
int year = ca.get(Calendar.YEAR);
int month = ca.get(Calendar.MONTH);
System.out.println("今天是" + year + "年" + (month + 1) + "月" + ca.get(Calendar.DATE) + "日,星期" +getIndexArr(ca.get(Calendar.DAY_OF_WEEK)) + ",是今年的第" + ca.get(Calendar.DAY_OF_YEAR) + "天");
ca.set(Calendar.YEAR, 2008);
}
public static String getIndexArr(int i) {
String s[] = {"", "日", "一", "二", "三", "四", "五", "六"};
return s[i];
}
}
边栏推荐
- SSTI靶场
- 3 minutes to tell you how to become a hacker | Zero foundation to hacker introductory guide, you only need to master these five skills
- div设置一个最小高度和最大高度,但是中间可以靠内容撑开
- 社区版idea 最右侧没有Database怎么办
- 运算符和交互基础
- uncategorized SQLException; SQL state [null]; error code [0]; sql injection violation, syntax error
- uni-app: about custom components, easycom specs, uni_modules, etc.
- let到底会不会造成变量提升
- Understand JDBC in one article
- sqli-labs less3/4打靶笔记
猜你喜欢
随机推荐
CTF之misc-音视频隐写
[PASECA2019]honey_shop
sqli-labs less3/4打靶笔记
strcasecmp和strncasecmp
互联网商城盲盒app为何如此火爆
自定义异常类的使用
uncategorized SQLException; SQL state [null]; error code [0]; sql injection violation, syntax error
【墨者学院】身份认证失效漏洞实战
volatility内存取证----命令演示
P3 元宝第六单元笔记
jsonpath
盲注、报错注入、宽字节注入、堆叠注入学习笔记
文件上传漏洞的绕过
封装Cookie API
C#中default关键字用法简介
【小程序项目开发-- 京东商城】uni-app之分类导航区域
uni-app: about custom components, easycom specs, uni_modules, etc.
PHP-fpm
String类型字符串获取第一次或者最后一次出现的下标
npm run serve启动报错npm ERR Missing script “serve“









