Synchronization in Java means that multiple threads simultaneously access an object, variable, method,CodeWait,
Ensure that only the unique thread accesses the synchronized object (that is, the content repaired with synchronized ).This can also be done.
Solution: synchronization is to ensure that only one thread accesses the synchronization object at the same time,Ensure operation Synchronization
The thread sequence of the object, which is consistent with the sequence in which they send requests to access the synchronized object.Vector is the old version of jkd.
(In 1.0) a collection class,Because the vector is synchronized and the arraylist is not synchronized
The performance of vector is worse than that of arraylist.If you do not need to ensure synchronization, try to use arrylist,In
When synchronization is required, you can consider using vector(In fact, vector is not recommended for synchronization,
Java has a collection tool class collections, which can put an arraylist programming thread safely ).