Java中的waite()和notify()
提問(wèn)人:榮凡88發(fā)布時(shí)間:2020-10-13
waite()和notify()因?yàn)闀?huì)對(duì)對(duì)象的“鎖標(biāo)志”進(jìn)行操作,所以它們必須在synchronized函數(shù)或synchronized block中進(jìn)行調(diào)用。如果在non-synchronized函數(shù)或non-synchronized block中進(jìn)行調(diào)用,雖然能編譯通過(guò),但在運(yùn)行時(shí)會(huì)發(fā)生IllegalMonitorStateException的異常
繼續(xù)查找其他問(wèn)題的答案?
相關(guān)視頻回答
點(diǎn)擊加載更多評(píng)論>>