For the exam, we recommend you focus on the most common SQL data types and the ResultSet methods shown in Table 15-7.
John Mercier wrote:I believe the "snapshot" is the original array not the new copy created when a modification is made. When an iterator is created it has a reference to the internal array. If a modification is made while the iterator is still in use the internal array will change to a copy but the reference the iterator is using will point to the original array not the copy. I hope that makes sense.
Which methods from a CopyOnWriteArrayList will cause a new copy of the internal array to be created? (Choose all that apply.)
A and D are correct. Of the methods listed, only add and remove will modify the list and cause a new internal array to be created.
☐✗ B and C are incorrect based on the above. (OCP Objective 11.1)
The "snapshot" style iterator method uses a reference to the state of the array at the point that the iterator was created. This array never changes during the lifetime of the iterator, so interference is impossible and the iterator is guaranteed not to throw ConcurrentModificationException. The iterator will not reflect additions, removals, or changes to the list since the iterator was created. Element-changing operations on iterators themselves (remove, set, and add) are not supported. These methods throw UnsupportedOperationException.
The closest thing to a guarantee is that at any given time, when a thread is running, it will usually not have a lower priority than any thread in the runnable state. If a low-priority thread is running when a high-priority thread enters runnable, the JVM will usually preempt the running low-priority thread and put the high-priority thread in.
When the sleep or wait is over, or an object's lock becomes available, the thread can only reenter the runnable state. It will go directly from waiting to running (well, for all practical purposes anyway).
K. Tsang wrote:What exam are you preparing?
The OCPJP6 exam definitely have such questions.
The OCAJP7 and OCPJP7 do not have such questions according to the exam objectives.