1.
代码 证明HashMap是不安全的而HashTable是安全的。
2.
/**
* Created by does on 17/2/15.
*/
public class Super {
public static void main(String[] args) {
Super aSuper = new Super();
Sub sub =(Sub) aSuper;
}
}
class Sub extends Super{
}
3.
/**
* Created by does on 17/2/15.
*/
public class Test {
public static void main(String[] args) {
Test test = new Test();
try {
test.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}