0
I have a question, the teacher asked to insert elements in the chained list using the "for" but I’m having difficulty, the Class that creates the node is already working perfectly and the part that I was able to develop was this but this giving nullPointException when I try to insert from the second element on.
public void inserir(Node novoNode){
if(inicio == null){
inicio = novoNode;
} else {
Node aux = inicio;
for(int i = tamanho ; i < (tamanho +1) ; i++){
aux = aux.getProximo();
}
aux.setProximo(novoNode);
}
tamanho ++;
}
Who is "start"? How do you initialize the size? Who calls the insert method by passing the new?
– Giuliana Bezerra