1.final关键字和.net中的const关键字一样,是常量的修饰符,但是final还可以修饰类.方法.写法规范:常量所有字母都大写,多个单词中间用 "_"连接. 2.遍历集合ArrayList<Integer> list = new ArrayList<Integer>();list.add(1);list.add(3);list.add(5);list.add(7);// 遍历List方法1,使用普通for循环:for (int i = 0; i <
1.Date类 常用方法:long getTime(),用于返回当前时刻的毫秒值 Date d = new Date(2000); System.out.println(d.getTime());// 获得当前时刻的毫秒值 2.DateFormat类 DateFormat类是一个抽象类,用的时候常用其子类SimpleDateFormat 常用方法: String format(),用于将时间对象转为指定格式的时间,并以字符串方式返回 Date parse(),用于把字符串按照"格式字符串指定的格
Date类学习总结 1.计算某一月份的最大天数 Calendar time=Calendar.getInstance();time.clear();time.set(Calendar.YEAR,year); //year 为 int time.set(Calendar.MONTH,i-1);//注意,Calendar对象默认一月为0 int day=time.getActualMaximum(Calendar.DAY_OF_MONTH);//本月份的天数注:在使用set方法之
Date日期类 Date表示特定的时间,精确到毫秒; 构造方法: public Data() public Date(long date) 常用方法: public long getTime() public void setTime(long time) public Boolean before(Date when) public Boolean after(Date when) public int compareTo(Date anotherDate) public String toS