To remove the last node of the list, I just traversed till the last node and assigned it to null. But I still see the last node value. I am wondering why node = null does not have any effect.
void deleteLastNode(Node node){
while(node.next != null)
{
node = node.next;
}
node = null;
}