The advance of Java -- JFC(Java foundation classes library)(Day01)
2017-12-10 20:54
519 查看
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)//millisecond8. 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);
①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)//millisecond8. 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);
相关文章推荐
- The advance of Java -- IO, Thread(Day05)
- The advance of Java -- Html, Servlet(Day07)
- Effective Java 英文 第二版 读书笔记 Item 13:Minimize the accessibility of classes and members
- The advance of JAVA -- Regex, Set(Day02)
- The advance of Java -- Set, LinkedList, Map(Day03)
- Ignoring unused library classes...java.io.IOException: You have to specify '-keep' options for the s
- JAVA+ Proxool+ SQLserver 2008 “signer information does not match signer information of other classes in the same package”
- SonarQube-Java规范之Atomic-".equals()" should not be used to test the values of "Atomic" classes
- The advance of Java -- Jsp, Spring(Day10)
- The advance of Java -- SpringMVC, SpringMyBatis(Day11)
- The advance of Java -- Genericity, Exception, IO(Day04)
- The advance of Java -- JDBC(Day09)
- Java compiler level does not match the version of the instal
- Java出现No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
- The Basics of the MMAPI for Java Developers -> Advanced Media Playback
- Java出现No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
- Java compiler level does not match the version of the installed Java project 问题解决
- NotImplementedError: Only the following pseudo-classes are implemented: nth-of-type.
- The difference between equals and == of Java
- Java compiler level does not match the version of the installed Java project fac