title: Linked list addLast method
body: <p>How can I build an <code>addLast</code> method in Java? I already know <code>LinkedList</code> has a built-in method which does this)</p>
  
  <p>This is what I've tried:</p>
  
  <pre><code>public void addFirst(int d1, double d2) { 
      Link link = new Link(d1, d2); 
      link.nextLink = first; 
      first = link;
          }
  public void addLast(int d1 , double d2){
      Link v = new Link(d1, d2);
      v.nextLink = null;
      tail.nextLink = v;
     tail = v  
  </code></pre>
  
  <p>}</p>
  
  <pre><code>    public void printList() { 
      Link currentLink = first; 
      System.out.print("List: "); 
      while(currentLink != null) { 
      currentLink.printlink(); 
      currentLink = currentLink.nextLink; 
      } 
          System.out.println(""); 
  }
  </code></pre>
  
  <p>My <code>addFirst</code> method works, but I don't know how to connect them.</p>
  
  <p>in the main :</p>
  
  <pre><code>    LinkList list = new LinkList();  
           list.addFirst(4, 4.04); 
           list.addFirst(5, 5.05); 
           list.addlast(3,4.5);
           list.printList();
  </code></pre>