單項選擇題

同步代碼塊可以解決線程安全問題,關(guān)于其寫法格式正確的是()

A.protected(lock){操作共享資源代碼塊}
B.public(lock){操作共享資源代碼塊}
C.static(lock){操作共享資源代碼塊}
D.synchronized(lock){操作共享資源代碼塊}

微信掃碼免費搜題