搜尋此網誌

2012年5月31日 星期四

Java Interface can not define a synchronized method

interface所定義的方法,必須要被class實做, 如果在interface, 便把方法定義為synchronized(同步)的話, 那麼即便類別不需要做同步化的行為,也要被強迫實做synchronized, 這樣會使程式失去彈性,所以不可定義interface的方法為synchronized.