1、object类有哪些方法?
equals(), wait(), toString(), notify(), notifyAll(), hashCode(), getClass(), finalize(), clone();
2、Java的八种基本数据类型?
byte(1), , short(2), int(4), long(8), float(4), double(8), char(2), boolean(true, false);
3、集合容器
collection(List, set),map
List是有序,可重复集合,分为ArrayList, LinkedList, vector; 其中ArrayList的数据结构是动态数组,查询快,增删慢,线程不安全;LinkedList的数据结构是双向链表,查询慢,增删快;vector类似ArrayList,不过是线程安全的,显然效率也会低一些;
Set是无序,不可重复集合,分为HashSet, LinkedHashSet, treeSet;
Map可分为HashMap, LinkedHashMap, HashTable, TreeMap; 其中HashMap常用,它是基于数组和链表,但是线程不安全,HashTable是线程安全的,他的加锁机制是加关键字synchronized,效率不高;我们一般用concurrentHashMap, 他在jdk1.7之前才用的是segment分段锁机制,1.8开始采用CAS(乐观锁)+synchronized;