Run ❯
Get your
own Java
server
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Change Language
Go to Spaces
Ctrl+Alt+P
import java.util.ArrayList; import java.util.ConcurrentModificationException; public class Main { public static void main(String[] args) { ArrayList
cars = new ArrayList
(); cars.add("Volvo"); cars.add("BMW"); try { for (String car : cars) { cars.add("Ford"); } } catch (ConcurrentModificationException e) { System.out.println("Error: the list was changed inside the loop."); } } }
Error: the list was changed inside the loop.