System.currentTimeMillis()和new Date().getTime()比較

獲取時間毫秒數時System.currentTimeMillis()方法比new Date().getTime()效率高, 由於new Date().getTime()方法調用的System.currentTimeMillis()函數

 

Date類的構造函數直接調用的System.currentTimeMillis()獲取fastTime毫秒值:spa

 

getTime()方法在cdate爲空(Date對象在進行無參構造建立對象時cdate默認爲null)的狀況下直接返回fastTime.對象

相關文章
相關標籤/搜索