You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public static class Node { // Making new class named "Node"
int val; // Has part (Data)
Node next; // Has part (Next node reference)
}
public static void main(String[] args) {
// Making 4 new "Node Objects" (a, b, c, d)
Node a = new Node();
Node b = new Node();
Node c = new Node();
Node d = new Node();
// Assigning values and linking
a.val = 10;
a.next = b;
b.val = 20;
b.next = c;
c.val = 30;
c.next = d;
d.val = 40;
Node temp = a ; // shallow copy (Same as pointer in c language) : Does not create a new memory location, it is just an another name of the same meory location of a