Im copying an array of objects to the linked list from a student class that i already made, but in the 5th line , the following error is showing : (" cannot find symbol - class E ")
Why is that?
import java.util.*;
public class StudentLinkedList
{
private List<E[]> studentLL = new LinkedList<E[]>();
public StudentLinkedList(Student[] st)
{
for(int i = 0; i < st.length; i++)
{
studentLL.add(st[i]);
}
}
}
You probably wanted to write:
private List<Student> studentLL = new LinkedList<Student>();
instead.
When declaring such a field, you specify the type of the elements of a list. The type you have specified is E
, but the compiler doesn't know anything called that.
尝试将LinkedList实例更改为private List<Student> studentLL= new LinkedList<Student>();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.