Your code is not correct for adding to the tail of a linked list. A linked list should add a new node at the END of the current or last node. Since you only show that head is a node and more than likely this is a single pointer node, let's assume that head is what will point to the end of the node (you can change the name to tail). Your code would need to look at the last node (head in this case), and add the new node to it, then update the reference to the new node.
// Node head = null;
@Override
public void add( T newvalue ) {
Node newNode = new Node (newvalue); //define new node
if(head !=null){//make sure what you are pointing to exists
head.next = newNode; // set the next point to newNode
head = newNode; //change the reference to your tail (called head here)
} else{
head = newNodel; //if doesn't exist, just point to new node
}
}
That's the jist of what you want.
Honestly, you will want a head node and a tail node. Without the head node always pointing to the head, you will not be able to traverse the list. Head should point to the first node always and tail should point to the last node. At first, head and tail will point to the same null or 1st node. Then you move tail in the add function.