title: why node.next goes to the next node
body: <p>I am kind of new to programming and I am currently working on linked lists. I got this code somewhere online. </p>
  
  <pre><code>public class Node 
  {
      Node next;
      int data;
  
      public Node(int data) 
      {
          this.data=data;
      }
  
      public class LinkedList
      {    
          Node head;
          public void delete(int data) 
          {    
              Node current=head;
              while (current.next!=null)
              { 
                  if (current.next.data==data)
                  {
                      current.next= current.next.next;
                  }
               }
           }
       }
  }
  </code></pre>
  
  <p>The thing which I don't understand is why <code>node.next</code> points to the next node? In the Node class next is a data type Node. There is no next method in the Node class but in the <code>LinkedList</code> class when <code>current.next</code> is called it suppose to refer to the next node.   </p>