Luisruiz Luisruiz - 1 month ago 7
Java Question

not print Arraylist

I have a class where I have a

ArrayList
of
Checkbook
registered

in the same class I have a method

imprimirTalonario ()


deveria
which print the record
ArrayList
which I'll be working on that bad

public class Talonario
{
Boleta bol;
ArrayList registro = new ArrayList();
UsaBoleta usaboleta;
public void imprimirTalonario()
{
// Convert ArrayList to Object array
Object[] elements = registro.toArray();

// Print Object content
for (int a = 0; a < elements.length; a++)
{
System.out.println(elements[a]);
}
}
}

Answer

You will need to add elements to ArrayList By default ArrayList is empty

    ArrayList<Integer> registro = new ArrayList<Integer>();
    registro.add(10);
Comments