case 3: System.out.println("Hundens namn: "); String todelete=scan.nextLine(); for (Dog h : dogs) if (h.getname().equals(todelete)) { System.out.println(h); dogs.remove(h); System.out.println(); System.out.println(h+ " Är borttagen "); } break;
Exception in thread "main" java.util.ConcurrentModificationException
at java.util.AbstractList$Itr.checkForComodification( AbstractList.java:372)
at java.util.AbstractList$Itr.next(AbstractList.java: 343)
at Register.main(Register.java:68)
Thats the errormessage. The program runs fine except for when I want to delete an item it shows me the errormessage above. Whats wrong?