Thank you very much @Sauron and @Franck for the help with my homework, it's still kinda hard for me but I got the code to work, at least to make existeContracto(Contacto c) work, I tried to break it, wasn't able yet, so i think i'm ready to keep going with the rest of the code.
At first I did what @Sauron told me buy it kept returning the same error of null pointer
So I tried something with all you guys explained to me uptil now, and it worked.
This is the fix that I did, I don't know if it's perfect or the best, but
public boolean existeContacto(Contacto c){
for (int i=0;i<persona.length;i++){
if (persona[i]==null){
return false;
}
else {
if (persona [i].getNombre().equals(c.getNombre())){
return true;
}
}
}
return false;
}
So the first if checks for the null if it's null, then sends a false to addContacto, so it can add the new contact
if it sends true, checks if the contact has the same name, and if it is it sends the message "You can't add the same contact"
I think the last false is kinda redundant but if I take it out it breaks everything, so...
But for the rest it works fine