Replaced Synchronization
A declared synchronous method of the parent class under the Inheritance architecture can be overwritten by more specific child classes and declared as non-synchronous.
Example
/*** The Synchronized Method of the parent class can be changed to a non-Synchronized Method in the subclass * @ author wangyancheng * @ version 2012-11-12 */public class synextends {public static void main (string [] ARGs) {parentclass pcinst = new subclass (); // new parentclass (); set <integer> resultsets = collections. synchronizedset (New treeset <integer> (); createthread (pcinst, resultsets); CR Eatethread (pcinst, resultsets);} public static void createthread (final parentclass pcinst, final set <integer> valueset) {New thread (New runnable () {public void run () {While (true) {INTEGER tmpi = pcinst. dowork (); If (! Valueset. add (tmpi) {Throw new illegalstateexception ("incorrect data status, repeated :". concat (tmpi. tostring ();} Try {thread. sleep (100);} catch (interruptedexception IE) {IE. printstacktrace ();}}}}). start () ;}} class parentclass {private volatile int index; Public synchronized integer dowork () {Return Index ++ ;}} class subclass extends parentclass {private int index; @ override public integer dowork () {Return Index ++ ;}}