I have tow doubles in john meyers' exam, please help me,
1) one question was about Priority Queue, given
answer was "hi followed by ConcuttentAccessException",but when I ran this code it did not give me any Exception. How come ? 2) second was drag and drop question,given List < ? & gt; = new ArrayList< ? & gt;(); answer was it did not give any compile time error, but when i type this code ,it gave me compile time error that < ? & gt can not be resolved.. !!??
Please clarify my doubles Thanks
[ July 10, 2007: Message edited by: Bharat Makwana ] [ July 10, 2007: Message edited by: Bharat Makwana ]
ॐ सर्वे जना: सुखिनो भवन्तु , तथास्तु |
'May the whole world be happy, so be it'
Originally posted by Bharat Makwana: can you please elaborate more on this question when and how I may get exception
You may get the exception if someone (same or other thread) modifies the collection while you iterate over it. In your example, the loop uses an iterator, and you modify the list via the call of poll (you remove one element). But as you have seen, it depends on the implementation of the collection and the iterator whether you actually get the exception.