I'm having a question, the teacher asked me to insert elements in the linked list using "for" but I'm having difficulty, the class that creates the node is working perfectly and the part that I was able to develop was that nullPointException when I try to insert from the second element onwards.
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 ++;
}