No enclosing instance of type ChatServer is accessible. Must qualify the allocation with an enclosing instance of type ChatServer (e.g. x.new A() where x is an instance of ChatServer).
這是靜態方法使用動態內部類的錯誤,要將調用內部類的語句寫到一個新的方法中,再new一個自己的類,再調用新方法。
No enclosing instance of type ChatServer is accessible. Must qualify the allocation with an enclosing instance of type ChatServer (e.g. x.new A() where x is an instance of ChatServer).
這是靜態方法使用動態內部類的錯誤,要將調用內部類的語句寫到一個新的方法中,再new一個自己的類,再調用新方法。
主要相同點:Lock能完成Synchronized所實現的所有功能。 主要不同點:Lock有比Synchronized更精確的縣城予以和更好的性能。