Java Interview Questions


Q:

How to synchronize arraylist? \

 
A: by using the method Collections.synchronizedList(); ,

ArrayList al=new ArrayList();
al.add("lolo");
al.add("polo");
al.add("hai");

Collections.synchronizedList(al);
.


Java Interview Questions