This commit is contained in:
2026-03-15 21:08:59 +05:00
parent 775b21a9c4
commit 47caea45da

29
lr9/task_4/Main.java Normal file
View File

@@ -0,0 +1,29 @@
class Node {
public int value;
public Node next;
Node(int value, Node next) {
this.value = value;
this.next = next;
}
}
public class Main {
public static void main(String[] args) {
Node node0 = new Node(0, null);
Node node1 = new Node(1, null);
Node node2 = new Node(2, null);
Node node3 = new Node(3, null);
node0.next = node1;
node1.next = node2;
node2.next = node3;
Node ref = node0;
while (ref != null) {
System.out.println(" " + ref.value);
ref = ref.next;
}
}
}