Trying to sort out the linked lists. There is a class Node in which methods are registered, and there is a class List in which with the help of these methods elements of the list are added. I can not understand how to add more than one element correctly and then output them to the console. Sample code was taken from the linked list
private int data; private Node next; public int getData() { return this.data; } public void setData(int data) { this.data = data; } public void setNext(Node next) { this.next = next; } public Node getNext() { return this.next; } public static void main(String[] args) { Node nin = new Node(); nin.setData(2); System.out.print(nin.getData()); }