對java的一些小知識點的日常總結(不斷更新)

2021-09-13 16:23:18 字數 707 閱讀 3062

1.sleep() 和 wait() 有什麼區別??

sleep 是指休眠給定的時間,當這個時間達到之後,執行緒會再次醒來。

wait 是等待狀態,多長時間不清楚,由另乙個執行緒將其喚醒。

2.forward 和 redirect的區別?

forward: **,在下乙個頁面中,request 保留上乙個頁面中的 request 的所有值

redirect: 跳轉,不傳遞 request 物件。

3.集合執行緒安全

效能原因不經常使用:vector,hashtable

但是hashmap,arraylist執行緒不安全,提供

listsynarraylist = collections.synchronizedlist(new arraylist());

setsynhashset = collections.synchronizedset(new hashset());

mapsynhashmap = collections.synchronizedmap(new hashmap());

以及concurrenthashmap

4.hashmap的key可能會「相同」,

student a=new student(「1」);

student b=new student(「1」);

一些小的知識點

malloc calloc 等記憶體分配函式所獲得的記憶體塊都來自乙個稱為堆 heap 的儲存池。記憶體洩漏 memory leak 是指程式中己動態分配的堆記憶體由於某種原因程式未釋放或無法釋放,造成系統記憶體的浪費,導致程式執行速度減慢甚至系統崩潰等嚴重後果。記憶體洩漏缺陷具有隱蔽性 積累性的特...

一些小的知識點

1.recycleview中使用gridlayoutmanager使其有gridview的效果 布局,第乙個引數表示上下文,第二個引數表示 有多少列,如下 rv.setlayoutmanager new gridlayoutmanager this,3 在 布局中還可以修改引數,使其水平布局,那麼那...

java中一些小知識點(面試)

看別人部落格,發現這些題目還是有一定的迷惑性的,因此就在部落格中記錄下來。3 下列選項中,哪一項能夠正常編譯 c a int i integer.valueof 1.2 理由 integer.valueof int string 只有這兩種引數 b char c a 不能將字串型別轉化為字元型 c ...