title: Incompatible type error. found java.lang.Object required :Item
body: <p>I'm writing a generic code as follows:</p>
  
  <pre><code>class Link&lt;Item&gt;
     {
        public Item dData;
        public Link next;
        public Link(Item d)
         {
           dData=d;
         }
       public void displayLink()
         {
           System.out.println(dData);
         }
      }
     ............
     Link delete=first;
     1&gt;Item temp=delete.dData;// This code gives the error(mentioned at the title)
     2&gt;Item temp=(Item)delete.dData; //This code works fine (With a warning no error)
  </code></pre>
  
  <p>Why does line 1 gives error { Incompatible type error. found java.lang.Object required :Item }, when the following code works absolutely fine?</p>
  
  <pre><code>  public class Stack&lt;Item&gt;
     {
       private Node first = null;
       private class Node
        {
          Item item;
          Node next;
        }
       public boolean isEmpty()
        {      return first == null; }
       public void push(Item item)
        {
          Node oldfirst = first;
          first = new Node();
          first.item = item;
          first.next = oldfirst;
        }
       public Item pop()
        {
          Item item = first.item;// This statement works fine, then why not statement 1?
          first = first.next;
          return item;
        }
      }
  </code></pre>