Line 1 uses Enhanced for loop, alternative for Iterator, implicitly iterators are used, hence the above for loop line can be substituted for
Now the first iteration of for loop will execute smoothly and apple will be added, but as implicit iterator excutes and performs s = it.next() , Concurrent Modification Run Time Exception is Thrown Hence if Iterator used, addition an deletion should always be done through Iterator
This exception may be thrown by methods that have detected concurrent modification of an object when such modification is not permissible.
For example, it is not generally permissible for one thread to modify a Collection while another thread is iterating over it. In general, the results of the iteration are undefined under these circumstances.