SeigiroSpica
-
Posts
11 -
Joined
-
Last visited
Reputation Activity
-
SeigiroSpica reacted to Sauron in Java array phonebook problem
You haven't overridden the equals method for your class so its behavior is probably not what you think it is. You can either fix the existeContacto method to actually do the comparison you want or override the equals method in your class to do it. For the former:
public boolean existeContacto(Contacto c){ for(int i = 0; i < persona.length; i++){ if(c.getNombre().equals(persona[i].getNombre())) return true; } return false; }
-
SeigiroSpica reacted to Franck in Java array phonebook problem
That is not enough to correct the code but he needs it.
To the OP, check your contact object
it is created only once, it has a specific location in memory for that object.
When you add it to the list it will have a reference (pointer) to that variable and it does not contain the actual object.
You need to bring the Contacto contacto = new Contacto(); into the switch case 1.
This will create a new object each time and the Agenda will contain different object each time. If you don't do that and add many
contact with the same reference object when you change a value like the name all of them change to the same thing since they are the same object.
-
SeigiroSpica got a reaction from TheDelphiDude in [Help] Back up drivers and fresh install
Ohhh, okay, thank you very much for helping me @TheDelphiDude and @homeap5
It seems that what I knew was wrong haha
Oh well
Thank you for the answer of the drivers, also!
Do you recommend to install Win 10 32bits still or should I stay in Win 7?