Junior — Middle
What exception occurs when using the Fail-Fast strategy in collections during modification while iterating?
sobes.tech AI
Answer from AI
When using the Fail-Fast strategy in Java collections, if the collection is modified during iteration (except for iterator methods that support modification), a ConcurrentModificationException is thrown. This is a mechanism to prevent incorrect behavior when the collection is modified concurrently.