The advance of Java -- JFC(Java foundation classes library)(Day01)

1. System:

①System.currentTimeMills(): Gaining the current system's time in millisecond.

②System.getProperties(): Gaining the configuration information of system.

③System.getProperty(key): Gaining one of the configuration information by key - value.

2. Clone:

①deep clone: will copy a class's reference type and basic type.

②shallow clone: only copy basic type.

3.String:

①trim();Erase space.  

②subString(beginIndex); intercept.

③subString(begin,end); intercept(range)

④String.valueOf(5); other type coverted into String

⑤str.length(); gain length

⑥toUpperCase(); a -> A

⑦endsWith(".txt"); compare with the variable you deliver whether contain the key word '.txt'' at last.

⑧startsWith("ddd"): compare with the variable you deliver whether contain the key word 'ddd" at first.

⑨indexOf("h"); return the position of letter of variable 

⑩split("0") return a Array on the basis of splitting variable according to the character you pass. 

4. StringBuffer/StringBuilder:

saving time when we tend to connect String.

grammar: buf.append();

5. Math:

①random()

②pow()

③round()

6. BigDecimal:

Since double is accuracy. So if we want to calculate, using BigDecimal rather than double.

*If the result is non-repeating infinite decimals: 

b.divide(b1,2,BigDecimal...);
7. Timer/TimerTask:

multithreading

Timer t = new Timer();
	t.schedule(mission(TimerTask),delay,span)//millisecond
8. Date:

Date date =new Date();
		System.out.println(date);
		SimpleDateFormat s = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
		System.out.println(s.format(date));
		
		Calendar c = Calendar.getInstance();
		System.out.println(c.get(Calendar.DATE));
		System.out.println(c.get(Calendar.DAY_OF_MONTH));
		System.out.println(c.get(Calendar.DAY_OF_YEAR));
		
		c.add(Calendar.YEAR, 2);
		System.out.println(c.get(Calendar.YEAR));
		c.set(Calendar.MONTH, 1);
		
		date = c.getTime();
		System.out.println(date);
		
		c.setTime(date);
		date = s.parse("2017-03-14 12:10:20");
		System.out.println(date);



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值