title: required java.util.ArrayList<String>,found java.lang.Object : I do not understand the reason for this error
body: <p>Following are some snippets from a jsp page:</p>
  
  <pre><code>&lt;%! ArrayList songList = new ArrayList&lt;String&gt;(); %&gt;
  
      &lt;%
          songList = StoreSongLink.linkList;
          // linkList is a static variable in the class StoreSongLink
          // There the linkList is defined as public static ArrayList&lt;String&gt; linkList = new ArrayList&lt;String&gt;();
      %&gt;
  
  &lt;%}  else {
         for (ArrayList&lt;String&gt; list : songList){}
  
  %&gt;
  </code></pre>
  
  <p>The code inside the else srciplet produces an error <code>required java.util.ArrayList&lt;String&gt; found java.lang.Object</code>. Why is this ? I do not understand  the reason for this.</p>
  
  <p><em><strong>Why does the compiler say songList to be of type Object ?</em></strong></p>