I have a doubt regarding the arrangement of objects, in the attached image I have the declaration of the arrangement, then I charge with the set method, but when it comes to returning the loaded arrangement it does not return any value to me, I already made the constructors and the properties of each attribute of the person class, and by means of the set, assign the values that each space of the array will have but I do not know what to do for the array to show me the values, exactly the values of a position that I indicate by means of a validation.
Some advice I should correct in my code or change.
public Persona[] ConsultarSaldo(Persona[] arreglo){
for (int i = 0; i < arreglo.length; i++) {
if (arreglo[i] != null){
Persona objtemporal = new Persona();
objtemporal = arreglo[i];
double SaldoActual = objtemporal.getSaldo();
objtemporal.setSaldo(SaldoActual);
arreglo[i] = objtemporal;
}
}
return arreglo;
What I need is to preload the arrangement and when I call some method I return the saved value, but it is not returning it, if the exercise is to assign from the beginning the values of the class person to 10 clients per medium of an arrangement, and that's what I tried to do through the set, but when for example I ask to know how much balance the person in the account returns 0, as if he had nothing, in the same way with the other attributes, I obviously use a method where the get calls those values that are supposed to be already loaded in the array
When requesting the balance you are not returning the balance of any of the 10 positions of the array