title: What is the 'head' of a linked list?
body: <p>I'm working in linked lists in Java, so I'm trying to grasp the concept of a single linked list.</p>
  
  <p><code>head -&gt; 12 -&gt; 34 -&gt; 56 -&gt; null</code></p>
  
  <p><code>head.next</code> would be 12 (also the same as node1). However, what is head then?</p>
  
  <p><strong>Update:</strong> What is the difference between a reference and a pointer?</p>
  
  <p><strong>Update2:</strong> So if <code>head</code> is <code>12</code> and <code>head.next</code> is <code>34</code>, then doesn't mean this following function skips the first node to see if it's null?</p>
  
  <pre><code>public void add(Object data, int index)
      // post: inserts the specified element at the specified position in this list.
      {
          Node temp = new Node(data);
          Node current = head;
          // crawl to the requested index or the last element in the list,
          // whichever comes first
          for(int i = 1; i &lt; index &amp;&amp; current.getNext() != null; i++)
          {
              current = current.getNext();
          }
          // set the new node's next-node reference to this node's next-node reference
          temp.setNext(current.getNext());
          // now set this node's next-node reference to the new node
          current.setNext(temp);
          listCount++;// increment the number of elements variable
      }
  </code></pre>
  
  <p>Source: <a href="http://www.mycstutorials.com/articles/data_structures/linkedlists" rel="noreferrer">http://www.mycstutorials.com/articles/data_structures/linkedlists</a></p>