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