required java.util.ArrayList,found java.lang.Object : I do not understand the reason for this error

前端 未结 7 1280
逝去的感伤
逝去的感伤 2021-01-28 09:30

Following are some snippets from a jsp page:

<%! ArrayList songList = new ArrayList(); %>

    <%
        songList = StoreSongLink.linkLis         


        
7条回答
  •  孤城傲影
    2021-01-28 10:18

    ArrayList is, as you probably know, a raw type, when not using parametrized ArrayList declaration. So you effectively turned it to array list of Object instead of String, with your initialization:
    ArrayList songList = new ArrayList();

提交回复
热议问题