答案補充中。。。html
1、java基礎java
一、簡述java的幾種基本數據類型linux
JAVA的基本數據類型有:byte、char、boolean、short、int、long、float、doublegit
二、什麼是裝箱和拆箱面試
三、如何將long轉換爲intredis
①強轉:int i = (int)123Lspring
②將long裝箱爲Long,調用 intValue()數據庫
③將long轉爲String,再利用Interger類轉換 int i = Integer.parseInt(String.valueOf(123L)); 編程
若是待轉換的long超出int範圍,前兩種轉出負數,第三種會拋出NumberFormatException異常數組
四、經常使用集合考察
①ArrayList初始的大小,以及擴容機制
這裏考察源碼的閱讀,經過閱讀源碼(JDK1.8)就能找到答案:
ArrayList若是不指定大小,默認構造函數是這麼實現的:
public ArrayList() { this.elementData = DEFAULTCAPACITY_EMPTY_ELEMENTDATA; }
其中的elementData 就是實際存儲數據的數組,若是是默認初始化,在添加第一個元素的時候會默認將大小初始化爲 DEFAULT_CAPACITY,相關源碼以下:
/**
* The array buffer into which the elements of the ArrayList are stored.
* The capacity of the ArrayList is the length of this array buffer. Any
* empty ArrayList with elementData == DEFAULTCAPACITY_EMPTY_ELEMENTDATA
* will be expanded to DEFAULT_CAPACITY when the first element is added.
*/
transient Object[] elementData; // non-private to simplify nested class access
/**
* Default initial capacity.
*/
private static final int DEFAULT_CAPACITY = 10;
至此,能夠回答第一個問題,ArrayList默認初始大小就是10,
關於擴容,相關源碼以下:
/** * Increases the capacity to ensure that it can hold at least the * number of elements specified by the minimum capacity argument. * * @param minCapacity the desired minimum capacity */ private void grow(int minCapacity) { // overflow-conscious code int oldCapacity = elementData.length; int newCapacity = oldCapacity + (oldCapacity >> 1); if (newCapacity - minCapacity < 0) newCapacity = minCapacity; if (newCapacity - MAX_ARRAY_SIZE > 0) newCapacity = hugeCapacity(minCapacity); // minCapacity is usually close to size, so this is a win: elementData = Arrays.copyOf(elementData, newCapacity); }
其中的
int newCapacity = oldCapacity + (oldCapacity >> 1);
代表,擴容時時按照原大小加上原大小的一半進行擴容,這裏學到了一個逼格較高的操做,那就是右移一位,等價於除以2,可是效率要更高
②List裏面重複數據如何去重
本質都是遍歷而後藉助相關容器進行去重,好比set,hashmap
③hashmap的實現
底層實現仍是數組,經過hashcode肯定存放位置,若是同一位置已有數據則採用拉鍊法解決。
具體就是數組的每一個元素作成鏈表,經過鏈表進行擴展
五、多線程編程
多線程編程的實現方式,具體參考我整理的相關文章:[JAVA]JAVA實現多線程的三種方式
六、socket編程
七、線程池的使用
建立和關閉
2、javaEE基礎
一、springMVC的做用
二、用過Spring的哪些組件
三、Spring Bean的生命週期
四、簡述Ioc和AoP
3、SQL基礎
關於SQL的基礎,參考我轉載的:常見的數據庫SQL面試題以及答案
4、linux基礎
一、如何查看java程序狀態
二、linux下的經常使用命令
5、分佈式
一、緩存技術
二、消息隊列
三、負載均衡
redis、es、Nginx、solr、rocketMQ
6、項目工具
一、maven經常使用命令
二、IDEA
三、git經常使用命令
pull、push、commit、分支概念
四、缺陷管理
用過禪道,okit等