In the following code I get an error saying that collection cannot be converted to List. Why not? I thought when the method saveObject is called the part
List e = c;
equals
List e = ArrayList();
because c - although of type Collection - refers to ArrayList in the end
Code:
import java.util.*;
class Test {
int i;
Object prevObject;
public void saveObject(List e) {
prevObject = e;
i++;
}
public static void main (String[] args) {
Test t = new Test();
Collection c = new ArrayList();
t.saveObject(c);
}
}