- hashMap在单线程中使用大大提高效率,在多线程的情况下使用hashTable来确保安全。hashTable中使用synchronized关键字来实现安全机制,但是synchronized是对整张hash表进行锁定即让线程独享整张hash表,在安全同时造成了浪费。concurrentHashMap采用分段加锁的机制来确保安全容器类有两个接口Map和Colletion,显然HashMap实现自Map接口。Arrays.asList方法返回的这个List的实现类是java.util.Arrays.ArrayList这个类(而不是java.util.ArrayList)。D正确。SimpleDateFormal类原文复制:Date formats are not synchronized. It is
recommended to create separate format instances for each thread. Ifmultiple threads access a format concurrently, it must be synchronized externally.
math.floor() ——返回为double,小于参数的最大整数
math.round()——返回为int,参数加0.5,小于这个数的最大整数
long = long int
final修饰的类为最终类,不能被继承;
final修饰的方法可以被继承和重载,但不能被重写
final修饰的变量不能被修改,是个常量
finalize与c++中的析构函数有所区别,
子类可以覆盖该方法来实现资源清理工作,gc在回收对象之前调用该方法
public Test() throws RepletException {
try { System.out.println(“Test this Project!”) }catch (Exception e) {
throw new Exception(e.toString());
注意throws是写在方法上,申明要抛出的异常。throw是抛出异常。



