title: Create new head for a list with data
body: <p>Sorry for a noob question, but the syntax is a bit confusing here. I am asked to fill in the function to insert new element onto the front of a linked list. The code:</p>
  
  <pre><code>class LinkedList
  {
      public LinkedList ()
      {
          this.head = null;
      }
  
      /* returns true, if the list is empty, else false */
      public boolean isEmpty ()
      {
          return head == null;
      }
  
      /* returns the first element of the list, assuming that the list is not empty */
      public int front ()
      {
          return head.data;
      }
  
      /* prints the list */
      public void print ()
      {
          System.out.print("(");
          for (ListNode i = head; i != null; i = i.next)
              System.out.print(i.data + " ");
          System.out.println(")");
      }
  
      /* inserts x into the beginning of the list */
      public void insertFront (int x)
      {
          /* FILL HERE!!! */
      }
  }
  </code></pre>
  
  <p>The code for the nodes:</p>
  
  <pre><code>class ListNode
  {
      public ListNode()
      {
          this.data = 0;
          this.next = null;
      }
  
      public int data;
      public ListNode next;
  }
  </code></pre>
  
  <p>I figured I need to create a new node, assign the value of the current head for the next operator, and set the value equal to x. And then finally set the node to be the new head. </p>
  
  <p>Can someone show me how to perform those basic commands.</p>