I loaded a code here, it looks like this:
class Main {
Lista lista = new Lista();
public static void main(String[] args) {
i = 0;
String[] vetorExibir;
lista.exibicao(vetorExibir = new String[lista.lista.size()]);
while (i < vetorExibir.length) {
System.out.println(vetorExibir[i];
i++;
}
}
}
class Lista {
ArrayList<String> lista;
public Lista() {
lista = new ArrayList<>();
}
public String[] exibicao(String[] vetorExibir) {
int i = 0;
vetorExibir = new String[lista.size()];
while (i < lista.size()) {
vetorExibir[i] = lista.get(i);
} return vetorExibir;
}
}
Whereas the ArrayList already has data. It does not work, it does not display anything.