I'm trying to save different types of data in an arraylist, mainly String and int to have a database of people. After looking for ways to do it, I decided to create a separate class.
class Persona
{
private String nombre;
private int hora;
private int dia;
private int glucosa;
public Persona(int dia, int hora, int glucosa, String nombre)
{
this.nombre = nombre;
this.hora = hora;
this.dia = dia;
this.glucosa= glucosa;
}
...
}
And the class that used this data
import java.util.ArrayList;
public class Organizador
{
private ArrayList<Persona> personas;
public Organizador()
{
ArrayList<Persona> personas = new ArrayList<Persona>();
}
public void nuevaPersona()
{
personas.add(new Persona(dia, hora, glucosa, nombre));
}
}
However, it does not let me compile the Organizer class since it does not find the values of day, time, etc. and I am not sure what the problem is and that I am placing it wrong, I am lost.