title: java synchronized block for more than 1 objects?
body: <p>I have two arrays, and I need to synchronize access to them across threads. I am going to put them in a synchronized block. The problem is, I can pass only one of them to 'synchronized' st one go. </p>
  
  <p>How do I ensure that the access to both the arrays is synchronized?
  Do I put them in a class and create an object of it?
  Or I access the other array only in the synchronized block, and this takes care of synchronized access to it?</p>
  
  <p>Thanks,</p>