I wanted to simulate a simple phone application, that can manage contacts and handle messages.
I have created a function for my manageContacts Function, that I called delteContact.
However when I try to delete my contact I got this error, I checked my code and I don't see why it would trow that error?
private static void deleteContact() {
System.out.println("Bitte den Namen eingeben:");
String name = scanner.next();
if(name.equals("")){
System.out.println("Bitte den Namen eingeben:");
deleteContact();
}else{
boolean doesExist = false;
for(Contact c : contacts){
if(c.getName().equals(name)){
doesExist = true;
contacts.remove(c);
}
}
if(!doesExist){
System.out.println("Dieser Kontakt existiert nicht.");
}
}
showInitialOptions();
}
Can someone help me where I did here a mistake?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…