G
Glen Davie
Can someone explain what I have done wrong and how can it be corrected?
MyQueue.java:37: warning: [unchecked] unchecked call to add(E) as a member
of the raw type java.util.ArrayList
list.add(tmp);
^
public class MyQueue
{
private ArrayList list;
public MyQueue()
{
list = new ArrayList();
}
public static void main(String[] args) { }
public <T> void add(T tmp)
{
list.add(tmp);
}
public void print()
{
for(int i=0;i<list.size();i++)
{
System.out.println(list.get(i));
}
}
}
MyQueue.java:37: warning: [unchecked] unchecked call to add(E) as a member
of the raw type java.util.ArrayList
list.add(tmp);
^
public class MyQueue
{
private ArrayList list;
public MyQueue()
{
list = new ArrayList();
}
public static void main(String[] args) { }
public <T> void add(T tmp)
{
list.add(tmp);
}
public void print()
{
for(int i=0;i<list.size();i++)
{
System.out.println(list.get(i));
}
}
}