title: getting java.lang.Object cannot be converted to java.lang.Integer
body: <p>I was implementing Graph data structure in Java. 
  Here is my implementation:</p>
  
  <pre><code>    package Graph;
  
      import java.util.*;
      import java.io.*;
  
     public class Graphs
     {
         int size;
         LinkedList&lt;Integer&gt;[] ll;
  
         Graphs(int size)
         {
              this.size = size;
  
              ll = new LinkedList[size];
  
              for(int i=0; i&lt;size; i++)
                ll[i] = new LinkedList&lt;Integer&gt;();
  
         }
  
         public static void print(LinkedList lli)
         {
              for(Integer i: lli)
                  System.out.println(i);
  
              //for(int i=0; i&lt;lli.size(); i++)
              //    System.out.println(lli.get(i));
         }
  
         public static void addEdge(Graphs graph, int up, int to)
         {
             graph.ll[to].add(up);
         }
  
        public static void main(String args[])
        {
            int V=5;
            Graphs graph = new Graphs(V);
  
            addEdge(graph,1,2);
            addEdge(graph,1,3);
            addEdge(graph,2,3);
            addEdge(graph,3,1);
            addEdge(graph,3,2);
            addEdge(graph,3,4);
            addEdge(graph,4,3);
  
            print(graph.ll[3]);      
        }
  
     }
  </code></pre>
  
  <p>Basically I am creating an array of LinkedLists for the graph with each linked list for a vertex of the  graph.</p>
  
  <p>However, I am getting a java.lang.Object cannot be converted to java.lang.Integer at line number 24. Clueless as to why am I getting this error. Any suggestions as to what am I missing?</p>