I decided to write the simplest method - empty the node.
public static void Node <Integer> n1 (Node <Integer> n1) { while (n1 != null) n1 = n1.getNext(); } Found that the node has not changed. Moved the cycle to the main method - it works.
The question is: why the node has not changed inside the method, is the node an object? Why do stacks, queues, arrays, and other objects change inside the void methods, but the node does not?
UPD: this method which changes adds to the node the chain at the end of the node works.
public static void what (Node <Integer> n1, int a) { while (n1.hasNext()) n1 = n1.getNext(); Node <Integer> n7 = new Node <Integer> (a); n1.setNext(n7); }